处理org.elasticsearch.client.transport.NoNodeAvailableException [英] Handling org.elasticsearch.client.transport.NoNodeAvailableException

查看:1737
本文介绍了处理org.elasticsearch.client.transport.NoNodeAvailableException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的SpringBoot项目中,我已经使用JPA配置了弹性搜索。我正在使用ElasticsearchRepository。现在进行配置,当我使用本地主机时,一切正常,但是当我输入IP地址时,我面临异常-

Hi In my SpringBoot project i have configured elastic search using JPA. I am using ElasticsearchRepository for it. Now for the configuration when i am using localhost then everything works fine but when i am putting IP address then i am facing an exception-


org .elasticsearch.client.transport.NoNodeAvailableException:
个配置节点都不可用:
[{#transport#-1} {lDnuVli1Rriy-9j1pdozZA} {27.101.12.99} {27.101.12.99:9300} ]

org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:347)
〜[elasticsearch-5.6.11.jar:5.6.11]在
org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:245)
〜[elasticsearch-5.6.11.jar:5.6.11],售价为
org.elasticsearch.client.transport。 TransportProxyClient.execute(TransportProxyClient.java:59)
〜[elasticsearch-5.6.11.jar:5.6.11] at
org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:366 )
〜[elasticsearch-5.6 .11.jar:5.6.11] at
org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:408)
〜[elasticsearch-5.6.11.jar:5.6.11]在
org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:80)在
org.elasticsearch.action处
〜[elasticsearch-5.6.11.jar:5.6.11]。 ActionRequestBuilder.execute(ActionRequestBuilder.java:54)
〜[elasticsearch-5.6.11.jar:5.6.11] at
org.springframework.data.elasticsearch.core.ElasticsearchTemplate.index(ElasticsearchTemplate.java :571)
〜[spring-data-elasticsearch-3.0.10.RELEASE.jar:3.0.10.RELEASE],位于
org.springframework.data.elasticsearch.repository.support.AbstractElasticsearchRepository.save( AbstractElasticsearchRepository.java:156)
〜[spring-data-elasticsearch-3.0.10.RELEASE.jar:3.0.10.RELEASE] at
sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)
〜[na:1.8.0_151] at
sun.reflect.NativeMethodAccessorImpl.invoke(未知Sou rce)
〜[na:1.8.0_151] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(未知来源)
〜[na:1.8.0_151] at java.lang.reflect.Method .invoke(未知来源)
〜[na:1.8.0_151]

org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{lDnuVli1Rriy-9j1pdozZA}{27.101.12.99}{27.101.12.99:9300}] at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:347) ~[elasticsearch-5.6.11.jar:5.6.11] at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:245) ~[elasticsearch-5.6.11.jar:5.6.11] at org.elasticsearch.client.transport.TransportProxyClient.execute(TransportProxyClient.java:59) ~[elasticsearch-5.6.11.jar:5.6.11] at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:366) ~[elasticsearch-5.6.11.jar:5.6.11] at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:408) ~[elasticsearch-5.6.11.jar:5.6.11] at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:80) ~[elasticsearch-5.6.11.jar:5.6.11] at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:54) ~[elasticsearch-5.6.11.jar:5.6.11] at org.springframework.data.elasticsearch.core.ElasticsearchTemplate.index(ElasticsearchTemplate.java:571) ~[spring-data-elasticsearch-3.0.10.RELEASE.jar:3.0.10.RELEASE] at org.springframework.data.elasticsearch.repository.support.AbstractElasticsearchRepository.save(AbstractElasticsearchRepository.java:156) ~[spring-data-elasticsearch-3.0.10.RELEASE.jar:3.0.10.RELEASE] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_151] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_151] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_151] at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_151]

用于初始化Elastic Search的代码-

Code for initlizing Elastic Search -

@Bean
    public Client client() throws Exception {

        Settings  settings = Settings.builder()
                            .put("cluster.name",getElasticCluster())
                            .build();

        return new PreBuiltTransportClient(Settings.EMPTY)
                .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(getElasticHost()),getElasticPort()));
    }

    @Bean
    public ElasticsearchOperations elasticsearchTemplate() throws Exception {
        return new ElasticsearchTemplate(client());
    }




elasticsearch:
开玩笑:
代理:
主机:27.101.12.99
端口:9300

elasticsearch: jest: proxy: host: 27.101.12.99 port: 9300

我搜索了很多内容但对我而言,没有任何帮助。因此,请检查并获得帮助。

I had a lot of search but nothing is helpful in my case. So Please check and help.

推荐答案

应用程序中的elasticsearch客户端正在使用传输协议来加入集群。在最近的发行版中不赞成使用这种方法,并且已经将其删除。
这表示传输协议不是HTTP,并且您的笑话代理可能无法分析/模拟发送的数据。这就是为什么localhost可以运行但jest代理失败的原因。

The elasticsearch client in your application is joning the cluster using the transport protocoll. This approach is deprecated and already removed in recent releases. This said transport protocoll is not HTTP and your jest proxy probably fails to analyse/mock the data send. This is the reason why localhost works but jest proxy fails.

为了使您的应用程序与Elasticsearch的未来版本兼容,您应该考虑使用高级REST客户端而不会丢失spring应用的任何功能。很快,您将能够再次使用jest,因为REST客户端正在使用HTTP与Elasticsearch进行通信。

In order to have your application compatible with future releases of elasticsearch you should consider using the high level REST client without loosing any functionality for the spring app. And as a quick win you´ll be able to use jest again because the REST client is using HTTP to communicate with elasticsearch.

请查看以下内容,了解有关的详细信息客户端迁移(我假设基于stacktrace的elasticsearch版本,请加倍注意) https://www.elastic.co/guide/zh-CN/elasticsearch/client/java-rest/5.6/java-rest-high-level-migration .html

Please have a look on this for details about the client migration (I assumed the elasticsearch version based on the stacktrace, please double ckeck it) https://www.elastic.co/guide/en/elasticsearch/client/java-rest/5.6/java-rest-high-level-migration.html

这篇关于处理org.elasticsearch.client.transport.NoNodeAvailableException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆