简体   繁体   中英

How to check if ElasticSearch is running properly

I am new to ElasticSearch and I am facing issues while connecting to ElasticSearch. Please find below details:

  1. hq plugin and head plugin are showing different results:
    Output of HQ Plugin: 总部插件输出
    Output of Head Plugin: 头插件输出

  2. When I try to connect from my scala code, I get following error:

     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.InternalTransportClient.execute(InternalTransportClient.java:106) at org.elasticsearch.client.support.AbstractClient.index(AbstractClient.java:102) at org.elasticsearch.client.transport.TransportClient.index(TransportClient.java:340) at com.sksamuel.elastic4s.IndexDsl$IndexDefinitionExecutable$$anonfun$apply$1.apply(IndexDsl.scala:23) at com.sksamuel.elastic4s.IndexDsl$IndexDefinitionExecutable$$anonfun$apply$1.apply(IndexDsl.scala:23) at com.sksamuel.elastic4s.Executable$class.injectFuture(Executable.scala:21) at com.sksamuel.elastic4s.IndexDsl$IndexDefinitionExecutable$.injectFuture(IndexDsl.scala:20) at com.sksamuel.elastic4s.IndexDsl$IndexDefinitionExecutable$.apply(IndexDsl.scala:23) at com.sksamuel.elastic4s.IndexDsl$IndexDefinitionExecutable$.apply(IndexDsl.scala:20) at com.sksamuel.elastic4s.ElasticClient.execute(ElasticClient.scala:28) 

Here is my Code which I use for connection:

val settings = ImmutableSettings.settingsBuilder()
                                .put("cluster.name", "elasticsearch")
                                .build()
val client = ElasticClient.remote(settings, ElasticsearchClientUri("elasticsearch://10.50.xxx.xxx:9300"))
  1. I also checked my connection and I am able to successfully telnet 10.50.xxx.xxx on both 9200 and 9300 ports

  2. I read somewhere that the problem might be with http.cors , So I added following lines to /etc/elasticsearch/elasticsearch.yml file on the server:

     http.cors.allow-origin: "/.*/" http.cors.enabled: true 


    Please suggest what am I doing wrong ?

-- Update --
Thanks @ Evaldas Buinauskas, It was version problem, I had installed elastic version 2.0 and was using libraries and plugins of version 1.7. I downgraded my elastic to version 1.7 and everything worked!

The issue comes from different Elasticsearch, head plugin and Scala client versions.

In pre 2.0 Elasticsearch still supported deprecated _status endpoint (deprecated in 1.2.0)

Version 2.0 completely dropped it and replaced it with _recovery .

Both head and Scala weren't upgraded and tried to call dropped api.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM