Elasticsearch - NoNodeAvailableException [英] Elasticsearch - NoNodeAvailableException
本文介绍了Elasticsearch - NoNodeAvailableException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
设置设置= Settings.settingsBuilder()。put(cluster.name,Receptor.clusterName).build();
TransportClient transportClient = TransportClient.builder()。settings(settings).build();
客户端c = null;
try {
c = transportClient.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(Receptor.es_ip),9300));
} catch(UnknownHostException e){
System.err.println(Util.getTimestampStr()+UnknownHostException error。);
e.printStackTrace();
}
CreateIndexRequestBuilder createIndexRequestBuilder = c.admin()。indexes()。prepareCreate(indexName);
createIndexRequestBuilder.addMapping(documentName,json);
createIndexRequestBuilder.execute()。actionGet();
我可以在transportClient.connectedNodes()上获取我的ES节点,但是当我尝试添加一个新映射,我得到 NoNodeAvailableException 异常。此代码与以前版本的Elasticsearch一起使用。任何想法是什么问题?
NoNodeAvailableException [没有配置的节点可用:
[]]在
org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:280)
at
org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:197)
at
org.elasticsearch.client.transport.support.TransportProxyClient.execute(TransportProxyClient.java:55)
at
org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java :272)
at
org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:347)
at
org.elasticsearch.client.support.AbstractClient $ IndicesAdmin .execute(AbstractClient.java:1177)
org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:85)
org.elasticsearch.action.ActionRequestBuilder 。执行(ActionRequestBuilder.java:59)
解决方案
@AndreiStefan给了解决我的问题,感谢他链接的帖子。解决方案是直接的:
network.bind_host:0
谢谢你们。
I get the following error when trying to connect to Elasticsearch 2 using the Java API for ES 2. This is the code:
Settings settings = Settings.settingsBuilder().put("cluster.name", Receptor.clusterName).build();
TransportClient transportClient = TransportClient.builder().settings(settings).build();
Client c = null;
try {
c = transportClient.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(Receptor.es_ip), 9300));
} catch (UnknownHostException e) {
System.err.println(Util.getTimestampStr() + "UnknownHostException error.");
e.printStackTrace();
}
CreateIndexRequestBuilder createIndexRequestBuilder = c.admin().indices().prepareCreate(indexName);
createIndexRequestBuilder.addMapping(documentName, json);
createIndexRequestBuilder.execute().actionGet();
I'm able to get my ES node on the transportClient.connectedNodes() but when I try to add a new mapping I get the NoNodeAvailableException exception. This code worked with previous versions of Elasticsearch. Any idea of what's wrong?
NoNodeAvailableException[None of the configured nodes are available:
[]] at
org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:280)
at
org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:197)
at
org.elasticsearch.client.transport.support.TransportProxyClient.execute(TransportProxyClient.java:55)
at
org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:272)
at
org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:347)
at
org.elasticsearch.client.support.AbstractClient$IndicesAdmin.execute(AbstractClient.java:1177)
at
org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:85)
at
org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:59)
解决方案
@AndreiStefan gave the solution to my problem thanks to the post he linked. The solution was as straightforward as:
network.bind_host: 0
Thank you guys.
这篇关于Elasticsearch - NoNodeAvailableException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文