NoNodeAvailableException:没有配置的节点可用 [英] NoNodeAvailableException : None of the configured nodes are available

查看:2920
本文介绍了NoNodeAvailableException:没有配置的节点可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从我的Java Web Service中的弹性搜索中搜索
这里是我现在使用的方式:

I'm trying to search from Elastic Search within my Java Web Service, here's how I use now :

    Client client = new PreBuiltTransportClient(Settings.EMPTY).addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("192.168.10.150"), 9200));
    SearchResponse searchResponse = client.prepareSearch().execute().actionGet();

第一行可以没有错误地工作,但是当它进入第二行时,异常向下将发生以下情况:

The 1st line could work without an error, but when it goes to the 2nd line, the exception down below will occur :


NoNodeAvailableException [没有配置的节点可用:
[{#transport#-1} {TskPSVeBRR6CvCzP9EVhkQ } {192.168.10.150} {192.168.10.150:9200}]]

NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{TskPSVeBRR6CvCzP9EVhkQ}{192.168.10.150}{192.168.10.150:9200}]]

无论我使用 9200 9300 设置端口,结果是一样的。

No matter I use 9200 or 9300 to set the port, the results are the same.

另外,我试图搜索来自我的 .Net 程序使用 NEST ,它运行正常。这是我如何尝试:

Also, I've tried to search from my .Net program using NEST, and it run just fine. Here's how I tried :

    var node = new Uri("http://192.168.10.150:9200");
    var settings = new ConnectionSettings(node).DefaultIndex("iod-2017.03.08.*");
    _EsClient = new ElasticClient(settings);
    var index = String.Format("iod-{0}.{1:00}.{2:00}.*", item.TriggerTime.Year, item.TriggerTime.Month, item.TriggerTime.Day);
    var uniqueId = item.UniqueId.ToString();
    var result = _EsClient.Search<logs>(s => s.Index(index).Query(q => q.Match(t => t.Field(l => l.id).Query(uniqueId))));

我做了什么(防火墙版本的库,方法调用API等)我的Java程序错了?我目前的 Java 版本是 1.8.0.121 弹性搜索传输客户端的版本都是 5.2 即可。谢谢!

Did I do anything(Firewall, version of library, method to call the API, etc) wrong with my Java program? My current Java version is 1.8.0.121, the version of Elastic Search and Transport Client are both 5.2. Thanks!

推荐答案

如评论中所述,

如果你是您使用的是除弹性搜索之外的群集名称,那么您需要在设置中更新相同的设置。

If you are you using a cluster name other than elasticsearch, then you need to update the same in settings.

Settings settings = Settings.builder()
        .put("cluster.name", "myClusterName").build();

这篇关于NoNodeAvailableException:没有配置的节点可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆