NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{QVFHsEVaRHiYIb

使用java api和elastic search进行交互时,进行到如下代码编写:

elasticsearch:
  cluster:
    name: elasticsearch
  host: 127.0.0.1
  port: 9200

SearchRequestBuilder searchRequestBuilder = this.esClient
        .prepareSearch(INDEX)
        .setTypes(TYPE)
        .setQuery(boolQueryBuilder)
        .addSort(MovieSearch.RELEASE, SortOrder.DESC)
        .setFrom(0)
        .setSize(10)
        .setFetchSource(includes, null);

抛出错误 :NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{erAdMJ4wTNGxixzYoTGhCw}{127.0.0.1}{127.0.0.1:9200}]]

解决方案:

1、elastic search配置错误,es与java交互的默认端口号是9300,与http交互的端口号是9200,两者不要搞错了,我的就是这种情况,把application.yml配置文件里的es配置的port改为9300即可;

2、如果上述第一步骤还不起作用,则修改下es配置文件elasticsearch.yml中:

network.host: 127.0.0.1
cluster.name: elasticsearch

network.host即部署elastic search服务的机器ip,cluster.name可自定义,但是要和你项目中的elasticsearch.cluster.name值对应。上述两个方式可以顺利解决错误NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{erAdMJ4wTNGxixzYoTGhCw}{127.0.0.1}{127.0.0.1:9200}]]。


books 引申阅读: 使用quartz实现高级定制化定时任务(包含管理界面)

books 推荐阅读:elastic search搜索引擎实战demo:https://github.com/simonsfan/springboot-quartz-demo,分支:feature_es

发布了202 篇原创文章 · 获赞 571 · 访问量 147万+

猜你喜欢

转载自blog.csdn.net/fanrenxiang/article/details/86520634
今日推荐