Transport.tcp.port doesn't work for localhost?

I've the following problem: to do an integration test, I set up an embedded
node and then I create a TransportClient to connect to it.

The setup of the embedded node is (among other things):

port = 11547; // User ports range 1024 - 49151
tcpport = 9300;
settings.put("http.port", port);
settings.put("transport.tcp.port", tcpport);

    Settings esSettings = settings.build();


    node = NodeBuilder.nodeBuilder().local(true).settings(esSettings).

node(); //I tried setting local to false too
node.start();

and the transportclient is as simple as:

TransportClient client = new TransportClient();
client.addTransportAddress(new InetSocketTransportAddress(
"localhost", 9300));

    client.prepareIndex("test", "type").setSource("field", "value").

execute().actionGet();

(I tried both localhost and 127.0.0.1).

Anyway I get a connection refused when running the above code:

Caused by: java.net.ConnectException: Connection refused: localhost/127.0.
0.1:9300
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:708)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.connect(
NioClientBoss.java:150)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.
processSelectedKeys(NioClientBoss.java:105)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.process(
NioClientBoss.java:79)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.
run(AbstractNioSelector.java:318)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.run(
NioClientBoss.java:42)
at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(
ThreadRenamingRunnable.java:108)
at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(
DeadLockProofWorker.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.
java:615)
at java.lang.Thread.run(Thread.java:724)
[2014-04-01 17:48:10,836][TRACE][org.elasticsearch.transport.netty] [Cap 'N
Hawk] connect exception caught on transport layer [[id: 0x9526b405]]
java.net.ConnectException: Connection refused: localhost/127.0.0.1:9300
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:708)
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.connect(NioClientBoss.java:150)
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.processSelectedKeys(NioClientBoss.java:105)
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:79)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42)
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)

my colleague was successful when he tried to connect to another host. but
he fails with localhost.

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/a8c21baf-4d41-4d43-b695-660dbba85623%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

This usually means that there is no local server bound to that port. If
you're performing an integration test, it could be that you aren't giving
ES time to completely initialize and bind to the port and be ready to
accept connections. Or that you aren't configuring your local node to be a
server so it's not binding to the port to which you wish to connect.

I don't know the deterministic way to wait for ES to be listening to its
ports, so one of my production servers (that uses a TransportClient and
contains our business logic) waits 4 seconds for ES to start up, and then
waits for the Yellow status (at least) before it starts. That has never
failed to start-up properly, probably due to the TransportClient retrying
the initial connection if it's not yet available during the wait for yellow
status. Perhaps?

Your colleague's case is successful when connecting to another host because
more than likely ES is already up and running on that other host.

Brian

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/ec9ac253-236e-4ad2-b37b-d63e5030e018%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

You are starting local node, which is using local transport, which is not
listening on port 9300. The log message that you see is from transport
client that tries to connect to port 9300 but cannot. Try starting just
your node and you will be see that nobody listens on port 9300.

On Tuesday, April 1, 2014 12:52:41 PM UTC-4, Dario Rossi wrote:

I've the following problem: to do an integration test, I set up an
embedded node and then I create a TransportClient to connect to it.

The setup of the embedded node is (among other things):

port = 11547; // User ports range 1024 - 49151
tcpport = 9300;
settings.put("http.port", port);
settings.put("transport.tcp.port", tcpport);

    Settings esSettings = settings.build();


    node = NodeBuilder.nodeBuilder().local(true).settings(esSettings).

node(); //I tried setting local to false too
node.start();

and the transportclient is as simple as:

TransportClient client = new TransportClient();
client.addTransportAddress(new InetSocketTransportAddress(
"localhost", 9300));

    client.prepareIndex("test", "type").setSource("field", "value").

execute().actionGet();

(I tried both localhost and 127.0.0.1).

Anyway I get a connection refused when running the above code:

Caused by: java.net.ConnectException: Connection refused: localhost/127.0.
0.1:9300
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:708)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.
connect(NioClientBoss.java:150)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.
processSelectedKeys(NioClientBoss.java:105)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.
process(NioClientBoss.java:79)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.
run(AbstractNioSelector.java:318)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.run(
NioClientBoss.java:42)
at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(
ThreadRenamingRunnable.java:108)
at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run
(DeadLockProofWorker.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.
java:615)
at java.lang.Thread.run(Thread.java:724)
[2014-04-01 17:48:10,836][TRACE][org.elasticsearch.transport.netty] [Cap 'N
Hawk] connect exception caught on transport layer [[id: 0x9526b405]]
java.net.ConnectException: Connection refused: localhost/127.0.0.1:9300
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:708)
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.connect(NioClientBoss.java:150)
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.processSelectedKeys(NioClientBoss.java:105)
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:79)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42)
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)

my colleague was successful when he tried to connect to another host. but
he fails with localhost.

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/d573c5ca-ada7-48b9-acb5-12cbd925bdee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

So shall I set local to false?

Il giorno mercoledì 2 aprile 2014 15:06:04 UTC+1, Igor Motov ha scritto:

You are starting local node, which is using local transport, which is not
listening on port 9300. The log message that you see is from transport
client that tries to connect to port 9300 but cannot. Try starting just
your node and you will be see that nobody listens on port 9300.

On Tuesday, April 1, 2014 12:52:41 PM UTC-4, Dario Rossi wrote:

I've the following problem: to do an integration test, I set up an
embedded node and then I create a TransportClient to connect to it.

The setup of the embedded node is (among other things):

port = 11547; // User ports range 1024 - 49151
tcpport = 9300;
settings.put("http.port", port);
settings.put("transport.tcp.port", tcpport);

    Settings esSettings = settings.build();


    node = NodeBuilder.nodeBuilder().local(true).settings(esSettings

).node(); //I tried setting local to false too
node.start();

and the transportclient is as simple as:

TransportClient client = new TransportClient();
client.addTransportAddress(new InetSocketTransportAddress(
"localhost", 9300));

    client.prepareIndex("test", "type").setSource("field", "value").

execute().actionGet();

(I tried both localhost and 127.0.0.1).

Anyway I get a connection refused when running the above code:

Caused by: java.net.ConnectException: Connection refused: localhost/127.0
.0.1:9300
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:708
)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.
connect(NioClientBoss.java:150)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.
processSelectedKeys(NioClientBoss.java:105)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.
process(NioClientBoss.java:79)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector
.run(AbstractNioSelector.java:318)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.run(
NioClientBoss.java:42)
at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(
ThreadRenamingRunnable.java:108)
at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.
run(DeadLockProofWorker.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:615)
at java.lang.Thread.run(Thread.java:724)
[2014-04-01 17:48:10,836][TRACE][org.elasticsearch.transport.netty] [Cap 'N
Hawk] connect exception caught on transport layer [[id: 0x9526b405]]
java.net.ConnectException: Connection refused: localhost/127.0.0.1:9300
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:708)
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.connect(NioClientBoss.java:150)
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.processSelectedKeys(NioClientBoss.java:105)
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:79)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42)
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)

my colleague was successful when he tried to connect to another host. but
he fails with localhost.

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/c7a89428-58e3-45b6-a8a4-2b4a651351aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

If you want to be able to connect to it using Transport Client - yes or
remove it completely. If you still get some failure - post here complete
log.

On Wednesday, April 2, 2014 10:09:16 AM UTC-4, Dario Rossi wrote:

So shall I set local to false?

Il giorno mercoledì 2 aprile 2014 15:06:04 UTC+1, Igor Motov ha scritto:

You are starting local node, which is using local transport, which is not
listening on port 9300. The log message that you see is from transport
client that tries to connect to port 9300 but cannot. Try starting just
your node and you will be see that nobody listens on port 9300.

On Tuesday, April 1, 2014 12:52:41 PM UTC-4, Dario Rossi wrote:

I've the following problem: to do an integration test, I set up an
embedded node and then I create a TransportClient to connect to it.

The setup of the embedded node is (among other things):

port = 11547; // User ports range 1024 - 49151
tcpport = 9300;
settings.put("http.port", port);
settings.put("transport.tcp.port", tcpport);

    Settings esSettings = settings.build();


    node = NodeBuilder.nodeBuilder().local(true).settings(esSettings

).node(); //I tried setting local to false too
node.start();

and the transportclient is as simple as:

TransportClient client = new TransportClient();
client.addTransportAddress(new InetSocketTransportAddress(
"localhost", 9300));

    client.prepareIndex("test", "type").setSource("field", "value").

execute().actionGet();

(I tried both localhost and 127.0.0.1).

Anyway I get a connection refused when running the above code:

Caused by: java.net.ConnectException: Connection refused: localhost/
127.0.0.1:9300
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:
708)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.
connect(NioClientBoss.java:150)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.
processSelectedKeys(NioClientBoss.java:105)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.
process(NioClientBoss.java:79)
at org.elasticsearch.common.netty.channel.socket.nio.
AbstractNioSelector.run(AbstractNioSelector.java:318)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.run(
NioClientBoss.java:42)
at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(
ThreadRenamingRunnable.java:108)
at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.
run(DeadLockProofWorker.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor
.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(
ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
[2014-04-01 17:48:10,836][TRACE][org.elasticsearch.transport.netty] [Cap 'N
Hawk] connect exception caught on transport layer [[id: 0x9526b405]]
java.net.ConnectException: Connection refused: localhost/127.0.0.1:9300
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at
sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:708)
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.connect(NioClientBoss.java:150)
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.processSelectedKeys(NioClientBoss.java:105)
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:79)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42)
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)

my colleague was successful when he tried to connect to another host.
but he fails with localhost.

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/4a1a6942-8b26-4376-81cc-bd75d5f3c863%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

I set it to local = false and now I don't get anymore the connection
refused. But unfortunaly I get another thing:

[2014-04-02 15:19:23,218][DEBUG][org.elasticsearch.transport.netty] [Humus
Sapien] using worker_count[12], port[9300-9400], bind_host[null],publish_host
[null], compress[false], connect_timeout[30s], connections_per_node[2/3/6/1/
1], receive_predictor[512kb->512kb]
[2014-04-02 15:19:23,218][DEBUG][org.elasticsearch.client.transport] [Humus
Sapien] node_sampler_interval[5s]
[2014-04-02 15:19:23,232][DEBUG][org.elasticsearch.client.transport] [Humus
Sapien] adding address [[#transport#-1][d][inet[localhost/127.0.0.1:9300]]]
[2014-04-02 15:19:23,232][TRACE][org.elasticsearch.client.transport] [Humus
Sapien] connecting to listed node (light) [[
#transport#-1][d][inet[localhost/127.0.0.1:9300]]]
[2014-04-02 15:19:23,233][TRACE][org.elasticsearch.transport.netty] [Jean
Grey-Summers] channel opened: [id: 0x6045a678, /127.0.0.1:51541 => /127.0.
0.1:9300]
[2014-04-02 15:19:23,233][DEBUG][org.elasticsearch.transport.netty] [Humus
Sapien] connected to node [[
#transport#-1][d][inet[localhost/127.0.0.1:9300]]]
[2014-04-02 15:19:23,250][TRACE][org.elasticsearch.plugins] [Jean Grey-
Summers] starting to fetch info on plugins
[2014-04-02 15:19:23,262][WARN ][org.elasticsearch.client.transport] [Humus
Sapien] node [#transport#-1][d][inet[localhost/127.0.0.1:9300]] not part of
the cluster Cluster [elasticsearch], ignoring...

org.elasticsearch.client.transport.NoNodeAvailableException: No node
available
at org.elasticsearch.client.transport.TransportClientNodesService.execute(
TransportClientNodesService.java:219)
at org.elasticsearch.client.transport.support.InternalTransportClient.
execute(InternalTransportClient.java:106)
at org.elasticsearch.client.support.AbstractClient.index(AbstractClient.
java:82)
at org.elasticsearch.client.transport.TransportClient.index(TransportClient
.java:330)
at org.elasticsearch.action.index.IndexRequestBuilder.doExecute(
IndexRequestBuilder.java:314)
at org.elasticsearch.action.ActionRequestBuilder.execute(
ActionRequestBuilder.java:85)
at org.elasticsearch.action.ActionRequestBuilder.execute(
ActionRequestBuilder.java:59)
at com.mycode.estests.test.TransportTest.transportTest(TransportTest.java:
20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(
FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(
ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(
FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod
.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner
.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner
.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.
java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:
27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(
JUnit4IdeaTestRunner.java:74)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(
JUnitStarter.java:202)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

Il giorno mercoledì 2 aprile 2014 15:16:29 UTC+1, Igor Motov ha scritto:

If you want to be able to connect to it using Transport Client - yes or
remove it completely. If you still get some failure - post here complete
log.

On Wednesday, April 2, 2014 10:09:16 AM UTC-4, Dario Rossi wrote:

So shall I set local to false?

Il giorno mercoledì 2 aprile 2014 15:06:04 UTC+1, Igor Motov ha scritto:

You are starting local node, which is using local transport, which is
not listening on port 9300. The log message that you see is from transport
client that tries to connect to port 9300 but cannot. Try starting just
your node and you will be see that nobody listens on port 9300.

On Tuesday, April 1, 2014 12:52:41 PM UTC-4, Dario Rossi wrote:

I've the following problem: to do an integration test, I set up an
embedded node and then I create a TransportClient to connect to it.

The setup of the embedded node is (among other things):

port = 11547; // User ports range 1024 - 49151
tcpport = 9300;
settings.put("http.port", port);
settings.put("transport.tcp.port", tcpport);

    Settings esSettings = settings.build();


    node = NodeBuilder.nodeBuilder().local(true).settings(

esSettings).node(); //I tried setting local to false too
node.start();

and the transportclient is as simple as:

TransportClient client = new TransportClient();
client.addTransportAddress(new InetSocketTransportAddress(
"localhost", 9300));

    client.prepareIndex("test", "type").setSource("field", "value"

).execute().actionGet();

(I tried both localhost and 127.0.0.1).

Anyway I get a connection refused when running the above code:

Caused by: java.net.ConnectException: Connection refused: localhost/
127.0.0.1:9300
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:
708)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.
connect(NioClientBoss.java:150)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.
processSelectedKeys(NioClientBoss.java:105)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.
process(NioClientBoss.java:79)
at org.elasticsearch.common.netty.channel.socket.nio.
AbstractNioSelector.run(AbstractNioSelector.java:318)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.run
(NioClientBoss.java:42)
at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(
ThreadRenamingRunnable.java:108)
at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.
run(DeadLockProofWorker.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(
ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(
ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
[2014-04-01 17:48:10,836][TRACE][org.elasticsearch.transport.netty] [
Cap 'N Hawk] connect exception caught on transport layer [[id:
0x9526b405]]
java.net.ConnectException: Connection refused: localhost/127.0.0.1:9300
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at
sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:708)
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.connect(NioClientBoss.java:150)
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.processSelectedKeys(NioClientBoss.java:105)
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:79)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42)
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)

my colleague was successful when he tried to connect to another host.
but he fails with localhost.

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/c38cca3b-7643-4c02-8946-9d7e251567b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

I forgot, after setting up the embedded node, I wait the cluster status to
be Yellow with

Client client = node.client();
client.admin().cluster().prepareHealth().setWaitForYellowStatus().
execute().actionGet();

this is done on the embedded node.

Il giorno mercoledì 2 aprile 2014 15:24:35 UTC+1, Dario Rossi ha scritto:

I set it to local = false and now I don't get anymore the connection
refused. But unfortunaly I get another thing:

[2014-04-02 15:19:23,218][DEBUG][org.elasticsearch.transport.netty] [Humus
Sapien] using worker_count[12], port[9300-9400], bind_host[null],publish_host
[null], compress[false], connect_timeout[30s], connections_per_node[2/3/6/
1/1], receive_predictor[512kb->512kb]
[2014-04-02 15:19:23,218][DEBUG][org.elasticsearch.client.transport] [
Humus Sapien] node_sampler_interval[5s]
[2014-04-02 15:19:23,232][DEBUG][org.elasticsearch.client.transport] [
Humus Sapien] adding address [[
#transport#-1][d][inet[localhost/127.0.0.1:9300]]]
[2014-04-02 15:19:23,232][TRACE][org.elasticsearch.client.transport] [
Humus Sapien] connecting to listed node (light) [[
#transport#-1][d][inet[localhost/127.0.0.1:9300]]]
[2014-04-02 15:19:23,233][TRACE][org.elasticsearch.transport.netty] [Jean
Grey-Summers] channel opened: [id: 0x6045a678, /127.0.0.1:51541 => /127.0.
0.1:9300]
[2014-04-02 15:19:23,233][DEBUG][org.elasticsearch.transport.netty] [Humus
Sapien] connected to node [[
#transport#-1][d][inet[localhost/127.0.0.1:9300]]]
[2014-04-02 15:19:23,250][TRACE][org.elasticsearch.plugins] [Jean Grey-
Summers] starting to fetch info on plugins
[2014-04-02 15:19:23,262][WARN ][org.elasticsearch.client.transport] [
Humus Sapien] node [#transport#-1][d][inet[localhost/127.0.0.1:9300]] not
part of the cluster Cluster [elasticsearch], ignoring...

org.elasticsearch.client.transport.NoNodeAvailableException: No node
available
at org.elasticsearch.client.transport.TransportClientNodesService.execute
(TransportClientNodesService.java:219)
at org.elasticsearch.client.transport.support.InternalTransportClient.
execute(InternalTransportClient.java:106)
at org.elasticsearch.client.support.AbstractClient.index(AbstractClient.
java:82)
at org.elasticsearch.client.transport.TransportClient.index(
TransportClient.java:330)
at org.elasticsearch.action.index.IndexRequestBuilder.doExecute(
IndexRequestBuilder.java:314)
at org.elasticsearch.action.ActionRequestBuilder.execute(
ActionRequestBuilder.java:85)
at org.elasticsearch.action.ActionRequestBuilder.execute(
ActionRequestBuilder.java:59)
at com.mycode.estests.test.TransportTest.transportTest(TransportTest.java
:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(
FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(
ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(
FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.<span
style="color: #000;" class
...

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/abfaf316-eb85-4b77-a656-a119faeb326e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

You should specify the same cluster name for both node and transport
client. It looks like they are running in different clusters:

[2014-04-02 15:19:23,262][WARN ][org.elasticsearch.client.transport] [Humus
Sapien] node [#transport#-1][d][inet[localhost/127.0.0.1:9300]] not part of
the cluster Cluster [elasticsearch], ignoring...

On Wednesday, April 2, 2014 10:27:19 AM UTC-4, Dario Rossi wrote:

I forgot, after setting up the embedded node, I wait the cluster status to
be Yellow with

Client client = node.client();
client.admin().cluster().prepareHealth().setWaitForYellowStatus().
execute().actionGet();

this is done on the embedded node.

Il giorno mercoledì 2 aprile 2014 15:24:35 UTC+1, Dario Rossi ha scritto:

I set it to local = false and now I don't get anymore the connection
refused. But unfortunaly I get another thing:

[2014-04-02 15:19:23,218][DEBUG][org.elasticsearch.transport.netty] [
Humus Sapien] using worker_count[12], port[9300-9400], bind_host[null],publish_host
[null], compress[false], connect_timeout[30s], connections_per_node[2/3/6
/1/1], receive_predictor[512kb->512kb]
[2014-04-02 15:19:23,218][DEBUG][org.elasticsearch.client.transport] [
Humus Sapien] node_sampler_interval[5s]
[2014-04-02 15:19:23,232][DEBUG][org.elasticsearch.client.transport] [
Humus Sapien] adding address [[
#transport#-1][d][inet[localhost/127.0.0.1:9300]]]
[2014-04-02 15:19:23,232][TRACE][org.elasticsearch.client.transport] [
Humus Sapien] connecting to listed node (light) [[
#transport#-1][d][inet[localhost/127.0.0.1:9300]]]
[2014-04-02 15:19:23,233][TRACE][org.elasticsearch.transport.netty] [Jean
Grey-Summers] channel opened: [id: 0x6045a678, /127.0.0.1:51541 => /127.0
.0.1:9300]
[2014-04-02 15:19:23,233][DEBUG][org.elasticsearch.transport.netty] [
Humus Sapien] connected to node [[
#transport#-1][d][inet[localhost/127.0.0.1:9300]]]
[2014-04-02 15:19:23,250][TRACE][org.elasticsearch.plugins] [Jean Grey-
Summers] starting to fetch info on plugins
[2014-04-02 15:19:23,262][WARN ][org.elasticsearch.client.transport] [
Humus Sapien] node [#transport#-1][d][inet[localhost/127.0.0.1:9300]]
not part of the cluster Cluster [elasticsearch], ignoring...

org.elasticsearch.client.transport.NoNodeAvailableException: No node
available
at org.elasticsearch.client.transport.TransportClientNodesService.
execute(TransportClientNodesService.java:219)
at org.elasticsearch.client.transport.support.InternalTransportClient.
execute(InternalTransportClient.java:106)
at org.elasticsearch.client.support.AbstractClient.index(AbstractClient.
java:82)
at org.elasticsearch.client.transport.TransportClient.index(
TransportClient.java:330)
at org.elasticsearch.action.index.IndexRequestBuilder.doExecute(
IndexRequestBuilder.java:314)
at org.elasticsearch.action.ActionRequestBuilder.execute(
ActionRequestBuilder.java:85)
at org.elasticsearch.action.ActionRequestBuilder.execute(
ActionRequestBuilder.java:59)
at com.mycode.estests.test.TransportTest.transportTest(TransportTest.
java:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(
FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(
ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(
FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.<span
style="color: #000;" class
...

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/7da21dd1-e3cd-4e3e-8636-1eabb736593d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thanks, it works now.

I suggest to point out the detail about local transport in the docs for
TransportClient.

Il giorno mercoledì 2 aprile 2014 15:31:06 UTC+1, Igor Motov ha scritto:

You should specify the same cluster name for both node and transport
client. It looks like they are running in different clusters:

[2014-04-02 15:19:23,262][WARN ][org.elasticsearch.client.transport] [
Humus Sapien] node [#transport#-1][d][inet[localhost/127.0.0.1:9300]] not
part of the cluster Cluster [elasticsearch], ignoring...

On Wednesday, April 2, 2014 10:27:19 AM UTC-4, Dario Rossi wrote:

I forgot, after setting up the embedded node, I wait the cluster status
to be Yellow with

Client client = node.client();
client.admin().cluster().prepareHealth().setWaitForYellowStatus
().execute().actionGet();

this is done on the embedded node.

Il giorno mercoledì 2 aprile 2014 15:24:35 UTC+1, Dario Rossi ha scritto:

I set it to local = false and now I don't get anymore the connection
refused. But unfortunaly I get another thing:

[2014-04-02 15:19:23,218][DEBUG][org.elasticsearch.transport.netty] [
Humus Sapien] using worker_count[12], port[9300-9400], bind_host[null],publish_host
[null], compress[false], connect_timeout[30s], connections_per_node[2/3/
6/1/1], receive_predictor[512kb->512kb]
[2014-04-02 15:19:23,218][DEBUG][org.elasticsearch.client.transport] [
Humus Sapien] node_sampler_interval[5s]
[2014-04-02 15:19:23,232][DEBUG][org.elasticsearch.client.transport] [
Humus Sapien] adding address [[
#transport#-1][d][inet[localhost/127.0.0.1:9300]]]
[2014-04-02 15:19:23,232][TRACE][org.elasticsearch.client.transport] [
Humus Sapien] connecting to listed node (light) [[
#transport#-1][d][inet[localhost/127.0.0.1:9300]]]
[2014-04-02 15:19:23,233][TRACE][org.elasticsearch.transport.netty] [
Jean Grey-Summers] channel opened: [id: 0x6045a678, /127.0.0.1:51541 =>
/127.0.0.1:9300]
[2014-04-02 15:19:23,233][DEBUG][org.elasticsearch.transport.netty] [
Humus Sapien] connected to node [[
#transport#-1][d][inet[localhost/127.0.0.1:9300]]]
[2014-04-02 15:19:23,250][TRACE][org.elasticsearch.plugins] [Jean Grey-
Summers] starting to fetch info on plugins
[2014-04-02 15:19:23,262][WARN ][org.elasticsearch.client.transport] [
Humus Sapien] node [#transport#-1][d][inet[localhost/127.0.0.1:9300]]
not part of the cluster Cluster [elasticsearch], ignoring...

org.elasticsearch.client.transport.NoNodeAvailableException: No node
available
at org.elasticsearch.client.transport.TransportClientNodesService.
execute(TransportClientNodesService.java:219)
at org.elasticsearch.client.transport.support.InternalTransportClient.
execute(InternalTransportClient.java:106)
at org.elasticsearch.client.support.AbstractClient.index(AbstractClient
.java:82)
at org.elasticsearch.client.transport.TransportClient.index(
TransportClient.java:330)
at org.elasticsearch.action.index.IndexRequestBuilder.doExecute(
IndexRequestBuilder.java:314)
at org.elasticsearch.action.ActionRequestBuilder.execute(
ActionRequestBuilder.java:85)
at org.elasticsearch.action.ActionRequestBuilder.execute(
ActionRequestBuilder.java:59)
at com.mycode.estests.test.TransportTest.transportTest(TransportTest.
java:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(
FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(
ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(
FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.<span
style="color: #000;" class
...

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b05929e1-9aa8-4034-a9e3-91b75c3937a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.