Reputation: 727
I'm using elasticsearch in my project. but when deploying the project on a server it gives the exception, I read other same questions but didn't find solution: I changed the port to 9300 and it wasn't solved.
NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{EEv7PPi1SYqxodHCtCrfEw}{192.168.0.253}{192.168.0.253:9200}]]
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:344)
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:242)
at org.elasticsearch.client.transport.TransportProxyClient.execute(TransportProxyClient.java:59)
This is my configuration for elasticsearch in my code:
public static void postConstruct() {
try {
Settings settings = Settings.builder()
.put("cluster.name","my-application").build();
client = new PreBuiltTransportClient(settings)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(Bundle.application.getString("ELASTIC_ADDRESS")), Integer.parseInt(Bundle.application.getString("9200"))));
try {
client.admin().indices().prepareCreate("tempdata").get();
} catch (Exception e) {
e.printStackTrace();
}
} catch (UnknownHostException e) {
e.printStackTrace();
}
}
The version of elasticsearch bot in my project and on the server is the same. and this is what i get when I curl 'http://x.x.x.x:9200/?pretty'
{
"name" : "node-1",
"cluster_name" : "my-application",
"cluster_uuid" : "_na_",
"version" : {
"number" : "5.2.2",
"build_hash" : "f9d9b74",
"build_date" : "2017-02-24T17:26:45.835Z",
"build_snapshot" : false,
"lucene_version" : "6.4.1"
},
"tagline" : "You Know, for Search"
}
when I change the port to 9300, after some seconds the exception I see is this:
MasterNotDiscoveredException[null]
at org.elasticsearch.action.support.master.TransportMasterNodeAction$AsyncSingleAction$4.onTimeout(TransportMasterNodeAction.java:211)
at org.elasticsearch.cluster.ClusterStateObserver$ContextPreservingListener.onTimeout(ClusterStateObserver.java:307)
at org.elasticsearch.cluster.ClusterStateObserver$ObserverClusterStateListener.onTimeout(ClusterStateObserver.java:237)
at org.elasticsearch.cluster.service.ClusterService$NotifyTimeout.run(ClusterService.java:1157)
This is log of elasticsearch and I have no idea what are host1 and host2:
[2018-07-16T15:40:59,476][DEBUG][o.e.a.a.i.g.TransportGetIndexAction] [gCJIhnQ] no known master node, scheduling a retry
[2018-07-16T15:41:29,478][DEBUG][o.e.a.a.i.g.TransportGetIndexAction] [gCJIhnQ] timed out while retrying [indices:admin/get] after failure (timeout [30s])
[2018-07-16T15:41:29,481][WARN ][r.suppressed ] path: /bad-request, params: {index=bad-request}
org.elasticsearch.discovery.MasterNotDiscoveredException: null
at org.elasticsearch.action.support.master.TransportMasterNodeAction$AsyncSingleAction$4.onTimeout(TransportMasterNodeAction.java:211) [elasticsearch-5.2.2.jar:5.2.2]
at org.elasticsearch.cluster.ClusterStateObserver$ContextPreservingListener.onTimeout(ClusterStateObserver.java:307) [elasticsearch-5.2.2.jar:5.2.2]
at org.elasticsearch.cluster.ClusterStateObserver$ObserverClusterStateListener.onTimeout(ClusterStateObserver.java:237) [elasticsearch-5.2.2.jar:5.2.2]
at org.elasticsearch.cluster.service.ClusterService$NotifyTimeout.run(ClusterService.java:1157) [elasticsearch-5.2.2.jar:5.2.2]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:527) [elasticsearch-5.2.2.jar:5.2.2]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_91]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_91]
Upvotes: 0
Views: 1679
Reputation: 488
Because the number of comments has increased, here are some tips that might be helpful. I assume that you are using a standalone elasticsearch instance started using ES_HOME/bin/elasticsearch as the master node on the server machine.
Upvotes: 2