我正在开发一个grails web-app(目前在我的本地机器上),需要在我的网络上的服务器上查询elasticsearch。
我已采取以下步骤:
在BuildConfig.groovy
中添加以下行plugins {
...
runtime ":elasticsearch:0.0.3.4"
...
}
我还在Config.groovy中添加了以下内容:
elasticSearch {
client.mode = 'transport'
client.hosts = [
[host:'xxx.xxx.xxx.xxx', port:9200]
]
disableAutoIndex = 'true'
}
为了消除防火墙问题等已经使用curl运行查询,它工作正常:
curl -XGET 'http://xxx.xxx.xxx.xxx:9200/_search?pretty' -d '{...}
但我得到以下内容:
|Running Grails application
Error |
2014-10-23 09:17:52,278 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializing the application: Error creating bean with name 'searchableClassMappingConfigurator': Invocation of init method failed; nested exception is org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: []
Message: Error creating bean with name 'searchableClassMappingConfigurator': Invocation of init method failed; nested exception is org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: []
Line | Method
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by NoNodeAvailableException: None of the configured nodes are available: []
->> 273 | ensureNodesAreAvailable in org.elasticsearch.client.transport.TransportClientNodesService
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 192 | execute in ''
| 81 | execute . in org.elasticsearch.client.transport.support.InternalTransportClusterAdminClient
| 73 | execute in ''
| 118 | health . in org.elasticsearch.client.support.AbstractClusterAdminClient
| 154 | installMappings in org.grails.plugins.elasticsearch.mapping.SearchableClassMappingConfigurator
| 51 | configureAndInstallMappings in ''
| 262 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . in java.lang.Thread
Error |
Forked Grails VM exited with error
我已经在这里阅读了许多其他类似错误的答案,但我尝试过的任何工作都没有。有什么想法吗?
答案 0 :(得分:3)
传输在端口 9300 上完成(不在HTTP端口 9200 上)。同时检查此端口是否打开。
如果仍然失败,请检查右侧cluster.name
。默认情况下为elasticsearch
,因此如果您未在服务器/群集中更改它,则无需使用它。
否则请在您的问题上添加新的见解。