1

我正在开发一个 grails 网络应用程序(目前在我的本地机器上),它需要在我的网络上的服务器上查询弹性搜索。

我已采取以下步骤:

在 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

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

4

1 回答 1

3

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

如果仍然失败,请检查以使用正确的cluster.name. 它是elasticsearch默认设置,因此如果您没有在服务器/集群中更改它,则不需要它。

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

于 2014-10-23T08:51:42.210 回答