2015-11-06 582 views
0

我是ElasticSearch新手,在连接到ElasticSearch时遇到问题。请看以下细节:如何检查ElasticSearch是否正常运行

  1. HQ插件和插件都出现了不同的结果:
    HQ输出的插件: Output of HQ Plugin
    头输出的插件: Output of Head Plugin

  2. 当我尝试从我的scal一个代码,我获得以下错误:

    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) 
    

这是我的代码,我使用的连接:

val settings = ImmutableSettings.settingsBuilder() 
           .put("cluster.name", "elasticsearch") 
           .build() 
val client = ElasticClient.remote(settings, ElasticsearchClientUri("elasticsearch://10.50.xxx.xxx:9300")) 
  • 我还检查我的连接并且我能够在9200和9300端口上成功telnet 10.50.xxx.xxx

  • 我在某处读到问题可能与http.cors,So我添加下面的服务器上线/etc/elasticsearch/elasticsearch.yml文件:

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


    请建议我究竟做错了什么?

  • - 更新 -
    感谢@ Evaldas Buinauskas,这是版本的问题,我已经安装了弹性2.0版并使用图书馆和1.7版本的插件。我把我的弹性降到1.7版,一切正常!

    +1

    你能告诉你的elasticsearch版本,头部插件和scala客户端版本是什么? Elasticsearch在2.0中删除了'_status' api,它用于头部插件来确定集群健康状况,也许您的Scala客户端也在使用它。 '_status'被'_recovery'取代。 –

    +0

    谢谢,这是版本问题,我安装了弹性版本2.0,并使用1.7版的库和插件。我把我的弹性降到1.7版,一切正常! –

    回答

    1

    该问题来自不同的Elasticsearch,头部插件和Scala客户端版本。

    在前期2.0 Elasticsearch仍然支持弃用_status终点(在1.2.0不建议使用)

    2.0版完全放弃了它,并与_recovery取而代之。

    Head和Scala都没有升级,并试图调用掉落的API。

    相关问题