TransportClient hangs on addTransportClient

I have set up and started an elastic search node and confirmed it's
working with a couple of Python scripts. I have indexed a bunch of
documents and am able to search over them. However, I am having
trouble getting the Java client API working. So far I just have a very
simple class that attempts to connect to the server with a
TransportClient but it's hanging on the call to addTransportAddress.

public class ElasticTest {
public static void main(String[] args) {
Settings settings = ImmutableSettings.settingsBuilder() //
.put("cluster.name", "hotels") //
.put("client.transport.sniff", false) //
.build();
TransportClient client = new TransportClient(settings);
InetSocketTransportAddress transAddress = new
InetSocketTransportAddress("linux-dev", 9200);
client.addTransportAddress(transAddress);
client.close();
}
}

I have tried debugging it and hanging in
org.elasticsearch.client.transport.TransportClientNodeService on line
176 (stack copied below). Do you know what I might be doing wrong?

com.travelmatch.playground.ElasticTest at localhost:53279
Thread [main] (Suspended (breakpoint at line 176 in
TransportClientNodesService$ScheduledConnectNodeSampler))
TransportClientNodesService$ScheduledConnectNodeSampler.run() line:
176
TransportClientNodesService.addTransportAddress(TransportAddress)
line: 118
TransportClient.addTransportAddress(TransportAddress) line: 198
ElasticTest.main(String[]) line: 16
Daemon Thread [elasticsearch[Agon][timer]] (Running)
Daemon Thread [elasticsearch[Agon][scheduler]-pool-8-thread-1]
(Running)
Daemon Thread [New I/O client worker #1-2] (Running)
Daemon Thread [New I/O client worker #1-3] (Running)
Daemon Thread [New I/O client worker #1-1] (Running)
Daemon Thread [New I/O client worker #1-8] (Running)
Daemon Thread [New I/O client worker #1-6] (Running)
Daemon Thread [New I/O client worker #1-7] (Running)
Daemon Thread [New I/O client worker #1-5] (Running)
Daemon Thread [New I/O client worker #1-4] (Running)
Daemon Thread [elasticsearch[cached]-pool-1-thread-1] (Running)

I had the same problem and eventually found that I had to use port 9300.

Le 21/06/2011 14:51, Rob Young a écrit :

I have set up and started an Elasticsearch node and confirmed it's
working with a couple of Python scripts. I have indexed a bunch of
documents and am able to search over them. However, I am having
trouble getting the Java client API working. So far I just have a very
simple class that attempts to connect to the server with a
TransportClient but it's hanging on the call to addTransportAddress.

public class ElasticTest {
public static void main(String args) {
Settings settings = ImmutableSettings.settingsBuilder() //
.put("cluster.name", "hotels") //
.put("client.transport.sniff", false) //
.build();
TransportClient client = new TransportClient(settings);
InetSocketTransportAddress transAddress = new
InetSocketTransportAddress("linux-dev", 9200);
client.addTransportAddress(transAddress);
client.close();
}
}

I have tried debugging it and hanging in
org.elasticsearch.client.transport.TransportClientNodeService on line
176 (stack copied below). Do you know what I might be doing wrong?

com.travelmatch.playground.ElasticTest at localhost:53279
Thread [main] (Suspended (breakpoint at line 176 in
TransportClientNodesService$ScheduledConnectNodeSampler))
TransportClientNodesService$ScheduledConnectNodeSampler.run() line:
176
TransportClientNodesService.addTransportAddress(TransportAddress)
line: 118
TransportClient.addTransportAddress(TransportAddress) line: 198
ElasticTest.main(String) line: 16
Daemon Thread [elasticsearch[Agon][timer]] (Running)
Daemon Thread [elasticsearch[Agon][scheduler]-pool-8-thread-1]
(Running)
Daemon Thread [New I/O client worker #1-2] (Running)
Daemon Thread [New I/O client worker #1-3] (Running)
Daemon Thread [New I/O client worker #1-1] (Running)
Daemon Thread [New I/O client worker #1-8] (Running)
Daemon Thread [New I/O client worker #1-6] (Running)
Daemon Thread [New I/O client worker #1-7] (Running)
Daemon Thread [New I/O client worker #1-5] (Running)
Daemon Thread [New I/O client worker #1-4] (Running)
Daemon Thread [elasticsearch[cached]-pool-1-thread-1] (Running)

Thank you Cédric, that has indeed fixed the problem. Can anyone tell
me why Python connects on port 9200 but Java connects on port 9300?

On Jun 21, 1:54 pm, Cédric Champeau cedric.champ...@lingway.com
wrote:

I had the same problem and eventually found that I had to use port 9300.

Le 21/06/2011 14:51, Rob Young a crit :

I have set up and started an Elasticsearch node and confirmed it's
working with a couple of Python scripts. I have indexed a bunch of
documents and am able to search over them. However, I am having
trouble getting the Java client API working. So far I just have a very
simple class that attempts to connect to the server with a
TransportClient but it's hanging on the call to addTransportAddress.

public class ElasticTest {
public static void main(String args) {
Settings settings = ImmutableSettings.settingsBuilder() //
.put("cluster.name", "hotels") //
.put("client.transport.sniff", false) //
.build();
TransportClient client = new TransportClient(settings);
InetSocketTransportAddress transAddress = new
InetSocketTransportAddress("linux-dev", 9200);
client.addTransportAddress(transAddress);
client.close();
}
}

I have tried debugging it and hanging in
org.elasticsearch.client.transport.TransportClientNodeService on line
176 (stack copied below). Do you know what I might be doing wrong?

com.travelmatch.playground.ElasticTest at localhost:53279
Thread [main] (Suspended (breakpoint at line 176 in
TransportClientNodesService$ScheduledConnectNodeSampler))
TransportClientNodesService$ScheduledConnectNodeSampler.run() line:
176
TransportClientNodesService.addTransportAddress(TransportAddress)
line: 118
TransportClient.addTransportAddress(TransportAddress) line: 198
ElasticTest.main(String) line: 16
Daemon Thread [elasticsearch[Agon][timer]] (Running)
Daemon Thread [elasticsearch[Agon][scheduler]-pool-8-thread-1]
(Running)
Daemon Thread [New I/O client worker #1-2] (Running)
Daemon Thread [New I/O client worker #1-3] (Running)
Daemon Thread [New I/O client worker #1-1] (Running)
Daemon Thread [New I/O client worker #1-8] (Running)
Daemon Thread [New I/O client worker #1-6] (Running)
Daemon Thread [New I/O client worker #1-7] (Running)
Daemon Thread [New I/O client worker #1-5] (Running)
Daemon Thread [New I/O client worker #1-4] (Running)
Daemon Thread [elasticsearch[cached]-pool-1-thread-1] (Running)

On Tue, 2011-06-21 at 06:37 -0700, Rob Young wrote:

Thank you Cédric, that has indeed fixed the problem. Can anyone tell
me why Python connects on port 9200 but Java connects on port 9300?

9200 is for http transport, 9500 for thrift transport, and 9300 for ES's
"internal" transport, ie a protocol which only the ES server and clients
speak

clint

Further to what Clint said, you can find out exactly which addresses
and ports are being used by the nodes by using the http API to
retrieve the node information:
curl -XGET http://localhost:9200/_cluster/nodes

This returns the node information in json format and the address and
port which the node has published for internal transport is shown as
e.g. "transport_address":"inet[/127.0.0.1:9300]". Alternatively if you
are using an admin client e.g. http://mobz.github.com/elasticsearch-head/
then you can use that to query the cluster nodes information.

If you add more nodes to the cluster from the same machine they will
use different ports, the default setting is to use ports in the range
9300-9400 for the transport module, see
Elasticsearch Platform — Find real-time answers at scale | Elastic.

regards,
Caroline

On Jun 21, 2:44 pm, Clinton Gormley clin...@iannounce.co.uk wrote:

On Tue, 2011-06-21 at 06:37 -0700, Rob Young wrote:

Thank you Cédric, that has indeed fixed the problem. Can anyone tell
me why Python connects on port 9200 but Java connects on port 9300?

9200 is for http transport, 9500 for thrift transport, and 9300 for ES's
"internal" transport, ie a protocol which only the ES server and clients
speak

clint