Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not find any remote Racks for fallback : when creating DynoJedisClient with ConnectionPoolConfiguration #268

Open
rajatbehl opened this issue May 22, 2019 · 1 comment

Comments

@rajatbehl
Copy link

Hi,

I have created DynoJedisClient with ConnectionPoolConfiguration and trying to store and retrieve value. Client is created but it is failing while setting and getting any value.
Client is working fine when I do not provide ConnectionPoolConfiguration for building client

Exception in thread "main" com.netflix.dyno.connectionpool.exception.NoAvailableHostsException: NoAvailableHostsException: [host=Host [hostname=UNKNOWN, ipAddress=UNKNOWN, port=0, rack: UNKNOWN, datacenter: UNKNOW, status: Down, hashtag=null], latency=0(0), attempts=0]Could not find any remote Racks for fallback
at com.netflix.dyno.connectionpool.impl.lb.HostSelectionWithFallback.getFallbackHostPool(HostSelectionWithFallback.java:195)
at com.netflix.dyno.connectionpool.impl.lb.HostSelectionWithFallback.getConnection(HostSelectionWithFallback.java:135)
at com.netflix.dyno.connectionpool.impl.lb.HostSelectionWithFallback.getConnectionUsingRetryPolicy(HostSelectionWithFallback.java:122)
at com.netflix.dyno.connectionpool.impl.ConnectionPoolImpl.executeWithFailover(ConnectionPoolImpl.java:292)
at com.netflix.dyno.jedis.DynoJedisClient.d_set(DynoJedisClient.java:1399)
at com.netflix.dyno.jedis.DynoJedisClient.set(DynoJedisClient.java:1394)
at com.agnity.dynomite.DynoTest.main(DynoTest.java:104)

I am using cluster with 4 nodes in 2 DCs, with 2 racks in each DC with 1 server each. Here is my dynomite config from one of the nodes :

dyn_o_mite:
datacenter: dc-a
rack: rack1
dyn_listen: 10.32.18.131:7379
dyn_seeds:

  • 10.32.18.131:7380:rack2:dc-a:2147483647
  • 10.32.18.132:7379:rack1:dc-b:2147483647
  • 10.32.18.132:7380:rack2:dc-b:2147483647
    listen: 0.0.0.0:8379
    servers:
  • 127.0.0.1:6379:1
    tokens: '2147483647'
    secure_server_option: datacenter
    pem_key_file: conf/dynomite.pem
    data_store: 0
    stats_listen: 127.0.0.1:22222
    read_consistency : DC_QUORUM
    write_consistency : DC_QUORUM

Java Code:

package com.agnity.dynomite;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import org.apache.log4j.BasicConfigurator;

import com.netflix.dyno.connectionpool.ConnectionPoolConfiguration.LoadBalancingStrategy;
import com.netflix.dyno.connectionpool.Host;
import com.netflix.dyno.connectionpool.Host.Status;
import com.netflix.dyno.connectionpool.HostSupplier;
import com.netflix.dyno.connectionpool.OperationResult;
import com.netflix.dyno.connectionpool.TokenMapSupplier;
import com.netflix.dyno.connectionpool.impl.ConnectionPoolConfigurationImpl;
import com.netflix.dyno.connectionpool.impl.lb.HostToken;
import com.netflix.dyno.jedis.DynoJedisClient;

public class DynoTest {

private static DynoJedisClient client;

final Host host1 = new Host("10.32.18.131", "10.32.18.131", 8379, "rack1", "dc-a", Status.Up);
final Host host2 = new Host("10.32.18.131", "10.32.18.131", 8380, "rack2", "dc-a", Status.Up);
final Host host3 = new Host("10.32.18.132", "10.32.18.132", 8379, "rack1", "dc-b", Status.Up);
final Host host4 = new Host("10.32.18.132", "10.32.18.132", 8380, "rack2", "dc-b", Status.Up);

final HostToken token1 = new HostToken(2147483647L, host1);
final HostToken token2 = new HostToken(2147483647L, host2);
final HostToken token3 = new HostToken(2147483647L, host3);
final HostToken token4 = new HostToken(2147483647L, host4);

public DynoJedisClient getClient() {
	System.out.println("getting clinet");
	List<Host> hosts;
	hosts = new ArrayList<>();
	hosts.add(host1);
	hosts.add(host2);
	hosts.add(host3);
	hosts.add(host4);

	final List<HostToken> hostTokens = new ArrayList<>();
	hostTokens.add(token1);
	hostTokens.add(token2);
	hostTokens.add(token3);
	hostTokens.add(token4);

	final HostSupplier localHostSupplier = new HostSupplier() {

		@Override
		public List<Host> getHosts() {

			return hosts;
		}
	};

	final TokenMapSupplier supplier = new TokenMapSupplier() {
		@Override
		public List<HostToken> getTokens(Set<Host> activeHosts) {
			return hostTokens;
		}

		@Override
		public HostToken getTokenForHost(Host host, Set<Host> activeHosts) {
			return null;
		}


	};
	
	ConnectionPoolConfigurationImpl config = new ConnectionPoolConfigurationImpl("mypool")
			.setCompressionThreshold(1000)
			.setConnectTimeout(5000)
			.setLoadBalancingStrategy(LoadBalancingStrategy.TokenAware)
			.setMaxConnsPerHost(25)
			.setMaxFailoverCount(2)
			.setMaxTimeoutWhenExhausted(2000)
			.setSocketTimeout(2000)
			.withTokenSupplier(supplier);
	
	client = new DynoJedisClient.Builder()
			.withApplicationName("DynomiteSampleClient")
			.withDynomiteClusterName("DynomiteSampleClient")
			.withHostSupplier(localHostSupplier)
			.withCPConfig(config)
			.build();

	return client;

}


static void init() {
	DynoTest dynoTest = new DynoTest();
	client = dynoTest.getClient();
}

public static void main(String[] args) {

	BasicConfigurator.configure();
	init();
	try {
		System.out.println("setting value");
		client.set("abc", "5678");
		System.out.println("value set");
		/*OperationResult<String> result = client.d_get("abc");
		System.out.println("clinet : " + result.getResult() + "node : " + result.getNode());
	*/
	} finally {
		System.out.println("closing connection");
		close();
	}
	
}

static void close() {
	client.stopClient();
}

}

Please suggest

@kanagasabai-karunanithy

@rajatbehl I need help to setup DYNO client for my dynomiteDB --> REDIS. kindly provide step by step procedure for DYNO setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants