我正在开发一个grails Web应用程序(当前在本地计算机上),该应用程序需要查询网络上服务器上的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 

对于类似的错误,我在这里已经阅读了许多其他答案,但我尝试过的任何方法都没有用。有任何想法吗?

请您参考如下方法:

传输在端口9300上完成(不在HTTP端口9200上完成)。还要检查该端口是否打开。

如果仍然失败,请检查是否也使用正确的cluster.name。默认情况下,它是elasticsearch,因此如果您没有在服务器/集群中对其进行更改,则不需要它。

否则,请在您的问题上添加新的见解。


评论关闭
IT序号网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!