Unable to connect Node (client)


(Brian Hudson) #1

I am running ES on my local dev machine with the following elasticsearch.yml:

cluster.name: myCluster
path.data: /usr/local/var/elasticsearch
path.logs: /usr/local/var/log/elasticsearch/
script.inline: on

I am trying to connect to the cluster using a Node(Client):

 NodeBuilder.nodeBuilder()
            .settings(Settings.builder()
                              .put("cluster.name", "myCluster")
                              .put("node.name", "myNode")
                              .put("path.home", "some/dir")
                              .put("discovery.zen.ping.unicast.hosts", "localhost")
                              .build())
            .client(true)
            .node();

However this results in master not found. This worked prior to ES 2.0, for 2.0 I added the path.home to settings.

I've worked around the issue for now by switching to the transport client, but would prefer to connect via Node(Client).


(Mark Walkom) #2

It's not https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking_20_network_changes.html#_bind_to_localhost is it?


(Brian Hudson) #3

I don't think so, both nodes are running on my local dev machine. I did see that though and played around with the network.host setting, but I was still unable to get the Node(Client) to connect.

TransportClient works with almost identical settings:

TransportClient client;
client  = TransportClient.builder()
                         .settings(Settings.builder()
                                           .put("cluster.name", "myCluster")
                                           .build())
                         .build();
client.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300));

(David Pilato) #4

network.host: localhost should work I think if you run on the same machine.

Did you change other settings? Such as port number for example?


(system) #5