[英]Java Transport Client for Elasticsearch throws NoNodeAvailableException
I am new to elasticsearch and trying to connect to a remote cluster running version 1.5.2.我是 elasticsearch 的新手,正在尝试连接到运行 1.5.2 版的远程集群。 I have added the same version Maven dependency to my project.
我已将相同版本的 Maven 依赖项添加到我的项目中。 I am initializing the Transport client using the following Scala code:
我正在使用以下 Scala 代码初始化传输客户端:
val settings: Settings = ImmutableSettings.settingsBuilder().put("cluster.name", "clusterName").put("client.transport.sniff", true).build()
val client: Client = new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress("XX.X.X.XX", 9300))
It then fails when i try to check if an index exists:然后当我尝试检查索引是否存在时失败:
val exists = client.admin().indices().prepareExists("index").execute().actionGet().isExists()
"clusterName" matches the property 'cluster.name' in the elasticsearch.yml on the cluster. “clusterName”与集群上 elasticsearch.yml 中的属性“cluster.name”匹配。 I have also tried upping the client.transport.ping_timeout and client.transport.nodes_sampler_interval to 30s to no avail and tried both with and without sniffing.
我还尝试将 client.transport.ping_timeout 和 client.transport.nodes_sampler_interval 提高到 30 秒但无济于事,并且尝试了嗅探和不嗅探。
I have used curl on port 9200 to verify that i can index and search on my elasticsearch instance.我在端口 9200 上使用 curl 来验证我可以索引和搜索我的 elasticsearch 实例。
Relevant Stack trace:相关堆栈跟踪:
org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: []
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:305)
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:200)
at org.elasticsearch.client.transport.support.InternalTransportIndicesAdminClient.execute(InternalTransportIndicesAdminClient.java:86)
at org.elasticsearch.client.support.AbstractIndicesAdminClient.exists(AbstractIndicesAdminClient.java:170)
at org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequestBuilder.doExecute(IndicesExistsRequestBuilder.java:53)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65)
Thanks in advance for any assistance.在此先感谢您的帮助。
我知道这是一个非常古老的问题,但我知道针对这种情况的一种解决方法是在您的设置中将嗅探添加到 false
put("client.transport.sniff", false)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.