Hello, 

I have an ES cluster that consists of two nodes. The first one is 
explicitly set to be a master and the second serves as a replica. The 
configuration of the nodes is following:

*Master Node:*
cluster.name: "test-es-cluster"
node.name: "primary1"
cluster.routing.allocation.awareness.force.group.values: primary, replica
cluster.routing.allocation.awareness.attributes: group
node.group: primary
node.master: true
node.data: true
bootstrap.mlockall: true
discovery.zen.minimum_master_nodes: 1

*Replica Node:*
cluster.name: "test-es-cluster"
node.name: "replica1"
cluster.routing.allocation.awareness.force.group.values: primary, replica
cluster.routing.allocation.awareness.attributes: group
node.group: replica
node.master: true
node.data: true
bootstrap.mlockall: true
discovery.zen.minimum_master_nodes: 1

Next step, I would like to explicitly connect to the replica node using a 
transport client. In order to do that, I add the client as follows:
Settings settings = ImmutableSettings.settingsBuilder()
.put("cluster.name", "test-es-cluster")
.put("client.transport.ping_timeout", "10s")
.put("client.transport.sniff", false)
.build(); 
Client client = new TransportClient(settings)
.addTransportAddress(new InetSocketTransportAddress(hostName, hostPort));

However, when I try to send any request to the node via the client, I catch 
the "No node available" exception:
org.elasticsearch.client.transport.NoNodeAvailableException: No node 
available
        at 
org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:196)
        at 
org.elasticsearch.client.transport.support.InternalTransportIndicesAdminClient.execute(InternalTransportIndicesAdminClient.java:73)
        at 
org.elasticsearch.client.support.AbstractIndicesAdminClient.stats(AbstractIndicesAdminClient.java:425)

Interestingly, If "client.transport.sniff" is set to be true, then 
everything works perfectly. But this way the client sends (round-robin) 
requests to the primary node too, which I try to avoid. If someone faced 
similar problem and can help to solve it, I will appreciate very much.

P.s. I run ElasticSearch 1.0.0 with AWS plugin (2.0.0.RC1) over the ec2 
instances. 

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/aec61522-40ff-4a80-acb2-1c88435998f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to