Can't get the java client to connect to the ES server when both are on my computer


(Ittai Zeidman) #1

Hi,
I've started working with ES in order to implement search capabilities in
my company's web-application.
I have a problem connecting a client node (via the java api) to the only
data node I'm running; They're both running locally on my computer (Win 7).
I had several issues with "Failed to create a selector" and "Unable to
establish loopback connection" exceptions on the server but they were
solved (or just postponed not sure) by disabling all firewalls (commercial
and windows) and by setting the "network.host" property in the
elasticsearch.yml config file of the data-node to the ip of the computer.
The problem I continued on to was not beeing able to connect from my
client-node to the other node, I thought the problem was with the fact I
did not configure a cluster.name property and so I set it in both the
elasticsearch.yml of the data-node and in the "settings map" of the
client-node.
Upon startup I get the following log warning: "waited for 30s and no
initial state was set by the discovery" and it continues but when I try to
perform an index operation I get a MasterNotDiscoveredException.
I've gisted the log of the data-node https://gist.github.com/1675252 and
the way I'm instantiating the client-node. https://gist.github.com/1675266
I'm really not sure why this is so hard...
Would appreciate any help pushing forward,
Ittai


(Karussell) #2

What is the full code you use to create the transport client?

Peter.

On 25 Jan., 09:06, Ittai Zeidman it...@fashion-traffic.com wrote:

Hi,
I've started working with ES in order to implement search capabilities in
my company's web-application.
I have a problem connecting a client node (via the java api) to the only
data node I'm running; They're both running locally on my computer (Win 7).
I had several issues with "Failed to create a selector" and "Unable to
establish loopback connection" exceptions on the server but they were
solved (or just postponed not sure) by disabling all firewalls (commercial
and windows) and by setting the "network.host" property in the
elasticsearch.yml config file of the data-node to the ip of the computer.
The problem I continued on to was not beeing able to connect from my
client-node to the other node, I thought the problem was with the fact I
did not configure a cluster.name property and so I set it in both the
elasticsearch.yml of the data-node and in the "settings map" of the
client-node.
Upon startup I get the following log warning: "waited for 30s and no
initial state was set by the discovery" and it continues but when I try to
perform an index operation I get a MasterNotDiscoveredException.
I've gisted the log of the data-node https://gist.github.com/1675252 and
the way I'm instantiating the client-node. https://gist.github.com/1675266
I'm really not sure why this is so hard...
Would appreciate any help pushing forward,
Ittai


(Ittai Zeidman) #3

Map<String,String> settings = new HashMap<String,String>();
settings.put("node.client","true");
settings.put("cluster.name","mycluster");
final NodeBuilder nodeBuilder = NodeBuilder.nodeBuilder();
nodeBuilder.getSettings().put(settings);
node = nodeBuilder.node();

It's a client-node and not a transport client.
It's also as a gist https://gist.github.com/1675266


(Karussell) #4

I think you either need the transport client or you need to start the
node and get the client from that + use data=false

http://groups.google.com/group/elasticsearch/browse_thread/thread/4082ea186bbb9c30

Peter.

On 25 Jan., 09:36, Ittai Zeidman it...@fashion-traffic.com wrote:

Map<String,String> settings = new HashMap<String,String>();
settings.put("node.client","true");
settings.put("cluster.name","mycluster");
final NodeBuilder nodeBuilder = NodeBuilder.nodeBuilder();
nodeBuilder.getSettings().put(settings);
node = nodeBuilder.node();

It's a client-node and not a transport client.
It's also as a gist https://gist.github.com/1675266


(Shay Banon) #5

Probably multicast still does not work on your end. You can set org.elastcisearch.discovery to TRACE to see a bit more whats going on.

On Wednesday, January 25, 2012 at 4:37 PM, Karussell wrote:

I think you either need the transport client or you need to start the
node and get the client from that + use data=false

http://groups.google.com/group/elasticsearch/browse_thread/thread/4082ea186bbb9c30

Peter.

On 25 Jan., 09:36, Ittai Zeidman <it...@fashion-traffic.com (http://fashion-traffic.com)> wrote:

Map<String,String> settings = new HashMap<String,String>();
settings.put("node.client","true");
settings.put("cluster.name (http://cluster.name)","mycluster");
final NodeBuilder nodeBuilder = NodeBuilder.nodeBuilder();
nodeBuilder.getSettings().put(settings);
node = nodeBuilder.node();

It's a client-node and not a transport client.
It's also as a gist https://gist.github.com/1675266


(Ittai Zeidman) #6

Hi Shay and Peter,
What actually solved the issue was just changing the above settings from
"node.client"/"true" to "node.data"/"false" which seems very strange to me
as in the elasticsearch site it says they're complimentary, right?
In any case I've verified that by swapping one with the other I'm no longer
hitting that wall (but others unfortunately).
If you still think I'm doing something wrong I'd be happy to hear.


(Shay Banon) #7

One you changed it from a node client, then it will act as a data node (the default, btw), which means it might possibly form its own cluster of a single node if it can't connect to other nodes.

On Wednesday, January 25, 2012 at 9:38 PM, Ittai Zeidman wrote:

Hi Shay and Peter,
What actually solved the issue was just changing the above settings from "node.client"/"true" to "node.data"/"false" which seems very strange to me as in the elasticsearch site it says they're complimentary, right?
In any case I've verified that by swapping one with the other I'm no longer hitting that wall (but others unfortunately).
If you still think I'm doing something wrong I'd be happy to hear.


(Ittai Zeidman) #8

Oh ok,
I see what you're saying.
I'll try to use the transport client and put the discovery log on trace and report back.
Can you give me some hints on what can cause problems with multicast?
I've disabled the firewalls.
Thanks!

ב-25 בינו 2012, בשעה 23:49, Shay Banon kimchy@gmail.com כתב/ה:

One you changed it from a node client, then it will act as a data node (the default, btw), which means it might possibly form its own cluster of a single node if it can't connect to other nodes.
On Wednesday, January 25, 2012 at 9:38 PM, Ittai Zeidman wrote:

Hi Shay and Peter,
What actually solved the issue was just changing the above settings from "node.client"/"true" to "node.data"/"false" which seems very strange to me as in the elasticsearch site it says they're complimentary, right?
In any case I've verified that by swapping one with the other I'm no longer hitting that wall (but others unfortunately).
If you still think I'm doing something wrong I'd be happy to hear.


(Shay Banon) #9

I am not sure what causes the problems with multicast…, if you set the discovery to TRACE logging and gist it, maybe it will give a hint. The TransportClient simply connects directly to the server (you explicitly add the address).

On Thursday, January 26, 2012 at 12:02 AM, Ittai Zeidman wrote:

Oh ok,
I see what you're saying.
I'll try to use the transport client and put the discovery log on trace and report back.
Can you give me some hints on what can cause problems with multicast?
I've disabled the firewalls.
Thanks!

ב-25 בינו 2012, בשעה 23:49, Shay Banon <kimchy@gmail.com (mailto:kimchy@gmail.com)> כתב/ה:

One you changed it from a node client, then it will act as a data node (the default, btw), which means it might possibly form its own cluster of a single node if it can't connect to other nodes.

On Wednesday, January 25, 2012 at 9:38 PM, Ittai Zeidman wrote:

Hi Shay and Peter,
What actually solved the issue was just changing the above settings from "node.client"/"true" to "node.data"/"false" which seems very strange to me as in the elasticsearch site it says they're complimentary, right?
In any case I've verified that by swapping one with the other I'm no longer hitting that wall (but others unfortunately).
If you still think I'm doing something wrong I'd be happy to hear.


(Ittai Zeidman) #10

Hi Shay,
I was indeed able to connect (and pass the test I mentioned in the other
question) by switching to a TransportClient.
I've gisted https://gist.github.com/1681639 the log of the client (when
using node.client(true)) and setting the Discovery to TRACE as you
suggested.
I did not see anything there but of course that unfortunately doesn't
guarantee anything.
I'd really rather use the client node (as to avoid the double hop) and so I
appreciate the help with trying to solve the multicast issue.
If there is anyhthing additional you'd like me to try please say so.

Thanks again,
Ittai


(Shay Banon) #11

Still not sure why multicast does not work, if you bind on localhost, try maybe 127.0.0.1. You can still use the node client, just configure it with unicast discovery. In the settings when you initialize the node, set: discovery.zen.ping.unicast.hosts to "host1,host2,…".

On Thursday, January 26, 2012 at 10:14 AM, Ittai Zeidman wrote:

Hi Shay,
I was indeed able to connect (and pass the test I mentioned in the other question) by switching to a TransportClient.
I've gisted (https://gist.github.com/1681639) the log of the client (when using node.client(true)) and setting the Discovery to TRACE as you suggested.
I did not see anything there but of course that unfortunately doesn't guarantee anything.
I'd really rather use the client node (as to avoid the double hop) and so I appreciate the help with trying to solve the multicast issue.
If there is anyhthing additional you'd like me to try please say so.

Thanks again,
Ittai


(system) #12