Java program failing with None of the configured nodes are available

Hi,

I'm new to Elastic search. I have 2 servers one server where Elasticsearch is configured and while other server is having java client installed. When trying to access Elasticsearch from Java program it is erroring out saying

None of the configured nodes are available: [{#transport#-1}{...}{...:9200}

Initially we thought firewalls but we have opened ports 9200, 9300 but still facing same issue. The same java program works if we have Elasticsearch installed locally.

Do you think it is still a firewall issue? If So please let me know what all ports need to be opened for Java program to work.

Thanks

Share your code and settings. Hard to tell here.

That said make sure you are using port 9300 from the client.

Thanks David for your response.

Do you need entire code or just part of it?

The code which creates the transport client.

Settings settings =
Settings.settingsBuilder().put("cluster.name", clusterName).build();
Client client =
TransportClient
.builder()
.settings(settings)
.build()
.addTransportAddress(
new InetSocketTransportAddress(InetAddress.getByName(host), port)
);

What do you have in port?

Also did you define network.host on the server?

I have a similar problem. However, my Elasticsearch is on 2.4 while I am using the API v2.3.3. Can this be the cause?

I believe it should be compatible but the best practice for the transport client is to use same version as the server.

1 Like