None of the configured nodes are available issue with spring boot

邮差的信 提交于 2019-12-04 04:53:22

I have found the solution ES2.0 is not working correctly so i re-install ES1.7.3 now it is working in my case. complete details here!

I had the same problem as you, and also using Jhipster too. As mentioned one possible solution is to downgrade your elasticsearch instance but if you don't want to downgrade it, here is what it worked for me:

  • update spring boot to the lastet version (> 1.4.0.RC1)
  • Configure ElasticsearchTemplate manually instead of using autoconfiguration.

Please if you need more information have a look to this post: http://ignaciosuay.com/how-to-connect-spring-boot-to-elasticsearch-2-x-x/

I encountered this error, and for me, the reason was that I was using the incorrect cluster name.

Steps to troubleshoot this error:

  1. Make sure that Spring Data Elasticsearch is compatible with the Elasticsearch version that you intend to use. There is a table in the project's README which corresponds Spring Data Elasticsearch versions with Elasticsearch versions:
    https://github.com/spring-projects/spring-data-elasticsearch#quick-start

    In my case, I am using Spring Data Elasticsearch 3.0.7. According to the table, I need to use Elasticsearch 5.5.0, but I have found that Spring Data Elasticsearch 3.0.7 appears to be compatible with Elasticsearch 5.6.x as well.

  2. Make sure that the spring.data.elasticsearch.cluster-nodes property specifies whatever port your Elasticsearch cluster is using for communication using the native Elasticsearch transport protocol.

    By default, Elasticsearch listens on two ports, 9200 and 9300. Port 9200 is for communication using the RESTful API. Port 9300 is for communication using the transport protocol:
    https://www.elastic.co/guide/en/elasticsearch/guide/current/_talking_to_elasticsearch.html

    The Java client that Spring Data Elasticsearch uses expects to communicate using the transport protocol (9300 by default).

  3. Make sure that the spring.data.elasticsearch.cluster-name property specifies the correct cluster name.

    If you do not specifically set this property, then the default is "elasticsearch".

    You can look up the Elasticsearch cluster name using the RESTful API:
    curl -XGET 'http://localhost:9200/?pretty'

    This command will print something similar to:

    {
      "name" : "XXXXXXX",
      "cluster_name" : "some_cluster_name",
      "cluster_uuid" : "XXXXXXXXXXXXXXXXXXXXXX",
      "version" : {
        "number" : "5.6.10",
        "build_hash" : "b727a60",
        "build_date" : "2018-06-06T15:48:34.860Z",
        "build_snapshot" : false,
        "lucene_version" : "6.6.1"
      },
      "tagline" : "You Know, for Search"
    }
    

    Make sure to set the value of the spring.data.elasticsearch.cluster-name property to the same string shown for "cluster_name".

You seem to be using JHipster (wonderful toolset if I may add) which uses

org.springframework.boot:spring-boot-starter-data-elasticsearch: -> 1.3.3.RELEASE

This only works with ElasticSearch BELOW 2.0 so just install ElasticSearch 1.7.3 and run your code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!