如何检查ElasticSearch是否正常运行

时间:2015-11-06 06:14:38

标签: scala elasticsearch elasticsearch-plugin

我是ElasticSearch的新手,我在连接到ElasticSearch时遇到问题。请找到以下详细信息:

  1. hq 插件和 head 插件显示不同的结果:
    HQ插件的输出: Output of HQ Plugin
    头部插件的输出: Output of Head Plugin

  2. 当我尝试从我的scala代码连接时,出现以下错误:

    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)
    
  3. 这是我用于连接的代码:

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

    2. 我在某处读到问题可能是http.cors,所以我在服务器上的/etc/elasticsearch/elasticsearch.yml文件中添加了以下行:

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


      请说明我做错了什么?

    3. - 更新 -
      谢谢@Evaldas Buinauskas,这是版本问题,我安装了弹性版本2.0,并使用1.7版本的库和插件。我将弹性降级到版本1.7,一切正常!

1 个答案:

答案 0 :(得分:1)

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

在2.0版之前,Elasticsearch仍支持弃用的_status端点(在1.2.0中弃用)

版本2.0完全删除它并将其替换为_recovery

head和Scala都没有升级,并试图调用drop api。