如何检查 ElasticSearch 是否 运行 正确
How to check if ElasticSearch is running properly
我是 ElasticSearch 的新手,在连接到 ElasticSearch 时遇到问题。请查看以下详细信息:
hq 插件和 head 插件显示不同的结果:
HQ 插件的输出:
Head 插件的输出:
当我尝试从我的 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.apply(IndexDsl.scala:23)
at com.sksamuel.elastic4s.IndexDsl$IndexDefinitionExecutable$$anonfun$apply.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 端口上成功地远程登录 10。50.xxx.xxx
我在某处读到问题可能出在 http.cors
,所以我在服务器上的 /etc/elasticsearch/elasticsearch.yml
文件中添加了以下行:
http.cors.allow-origin: "/.*/"
http.cors.enabled: true
请指出我做错了什么?
--更新--
感谢@Evaldas Buinauskas,这是版本问题,我已经安装了 elastic 2.0 版本并使用了 1.7 版本的库和插件。我将弹性降级到 1.7 版,一切正常!
我是 ElasticSearch 的新手,在连接到 ElasticSearch 时遇到问题。请查看以下详细信息:
hq 插件和 head 插件显示不同的结果:
HQ 插件的输出:
Head 插件的输出:当我尝试从我的 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.apply(IndexDsl.scala:23) at com.sksamuel.elastic4s.IndexDsl$IndexDefinitionExecutable$$anonfun$apply.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 端口上成功地远程登录 10。50.xxx.xxx
我在某处读到问题可能出在
http.cors
,所以我在服务器上的/etc/elasticsearch/elasticsearch.yml
文件中添加了以下行:http.cors.allow-origin: "/.*/" http.cors.enabled: true
请指出我做错了什么?
--更新--
感谢@Evaldas Buinauskas,这是版本问题,我已经安装了 elastic 2.0 版本并使用了 1.7 版本的库和插件。我将弹性降级到 1.7 版,一切正常!