【问题标题】:NoNodeAvailableException when installing elasticsearch plugin in grails在 grails 中安装 elasticsearch 插件时出现 NoNodeAvailableException
【发布时间】:2014-12-18 21:28:33
【问题描述】:

我正在开发一个 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

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

【问题讨论】:

    标签: grails groovy elasticsearch elasticsearch-plugin


    【解决方案1】:

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

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

    否则,请针对您的问题添加新见解。

    【讨论】:

    • 谢谢!将端口更改为 9300 消除了错误。我假设它会像 curl 查询一样是 9200。您不知道有关搜索的任何示例或教程吗?我有 json,我只想进行搜索并使用结果,但我在任何地方都找不到简单的示例。
    • 不直接,因为我不使用插件。但根据noamt.github.io/elasticsearch-grails-plugin/guide/…elasticsearchService.search() 似乎可以让你这样做。如果您有其他问题,请创建新问题,因为 SO 不是论坛格式。
    猜你喜欢
    • 2017-11-01
    • 2017-06-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-06
    • 2013-11-15
    相关资源
    最近更新 更多