gpt4 book ai didi

elasticsearch - Elasticsearch 集群

转载 作者:行者123 更新时间:2023-12-02 22:44:36 27 4
gpt4 key购买 nike

我正在尝试 flex 搜索,并且很难在具有3个 flex 搜索实例的单台计算机上创建集群。我对实例进行了以下更改:

  • 在所有实例
  • 上更改了群集名称{cluster.name:es-stack}
  • 在所有实例
  • 上更改了节点名称{node.name:node-1,node.name:node-2,node.name:node-3}
  • 更改了http端口{http.port:9203,http.port:9202,http.port:9201}
  • 更改了ping单播{discovery.zen.ping.unicast.hosts:[“127.0.0.1:9201","127.0.0.1:9202”]}

  • 实例上的elasticsearch.yml看起来像:
    # Instance 1
    cluster.name: es-stack
    node.name: node-1
    http.port: 9201
    discovery.zen.ping.unicast.hosts: ["127.0.0.1:9202", "127.0.0.1:9203"]

    # Instance 2
    cluster.name: es-stack
    node.name: node-2
    http.port: 9202
    discovery.zen.ping.unicast.hosts: ["127.0.0.1:9201", "127.0.0.1:9203"]

    # Instance 3
    cluster.name: es-stack
    node.name: node-3
    http.port: 9203
    discovery.zen.ping.unicast.hosts: ["127.0.0.1:9201", "127.0.0.1:9202"]

    经过这些配置后,当我尝试启动实例时,我无法获得集群环境。启动 flex 搜索实例时,日志文件中的错误跟踪显示:
    [2016-11-30T23:25:59,320][INFO ][o.e.t.TransportService   ] [node-2] publish_address {127.0.0.1:9301}, bound_addresses {[fe80::1]:9301}, {[::1]:9301}, {127.0.0.1:9301}
    [2016-11-30T23:26:02,493][WARN ][o.e.d.z.p.u.UnicastZenPing] [node-2] [1] failed send ping to {#zen_unicast_2#}{_V9wDP7mRBWfMT35KqH63w}{::1}{[::1]:9201}
    java.lang.IllegalStateException: handshake failed with {#zen_unicast_2#}{_V9wDP7mRBWfMT35KqH63w}{::1}{[::1]:9201}
    at org.elasticsearch.transport.TransportService.handshake(TransportService.java:364) ~[elasticsearch-5.0.0.jar:5.0.0]
    at org.elasticsearch.transport.TransportService.connectToNodeLightAndHandshake(TransportService.java:339) ~[elasticsearch-5.0.0.jar:5.0.0]
    at org.elasticsearch.transport.TransportService.connectToNodeLightAndHandshake(TransportService.java:313) ~[elasticsearch-5.0.0.jar:5.0.0]
    at org.elasticsearch.discovery.zen.ping.unicast.UnicastZenPing$2.run(UnicastZenPing.java:419) [elasticsearch-5.0.0.jar:5.0.0]
    at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:444) [elasticsearch-5.0.0.jar:5.0.0]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_111]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_111]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111]
    Caused by: org.elasticsearch.transport.ReceiveTimeoutTransportException: [][[::1]:9201][internal:transport/handshake] request_id [1] timed out after [3010ms]
    at org.elasticsearch.transport.TransportService$TimeoutHandler.run(TransportService.java:840) ~[elasticsearch-5.0.0.jar:5.0.0]
    ... 4 more
    [2016-11-30T23:26:02,493][WARN ][o.e.d.z.p.u.UnicastZenPing] [node-2] [1] failed send ping to {#zen_unicast_1#}{AZZtXAfATv2xSWaYo9hCWQ}{127.0.0.1}{127.0.0.1:9201}
    java.lang.IllegalStateException: handshake failed with {#zen_unicast_1#}{AZZtXAfATv2xSWaYo9hCWQ}{127.0.0.1}{127.0.0.1:9201}
    at org.elasticsearch.transport.TransportService.handshake(TransportService.java:364) ~[elasticsearch-5.0.0.jar:5.0.0]
    at org.elasticsearch.transport.TransportService.connectToNodeLightAndHandshake(TransportService.java:339) ~[elasticsearch-5.0.0.jar:5.0.0]
    at org.elasticsearch.transport.TransportService.connectToNodeLightAndHandshake(TransportService.java:313) ~[elasticsearch-5.0.0.jar:5.0.0]
    at org.elasticsearch.discovery.zen.ping.unicast.UnicastZenPing$2.run(UnicastZenPing.java:419) [elasticsearch-5.0.0.jar:5.0.0]
    at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:444) [elasticsearch-5.0.0.jar:5.0.0]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_111]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_111]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111]
    Caused by: org.elasticsearch.transport.ReceiveTimeoutTransportException: [][127.0.0.1:9201][internal:transport/handshake] request_id [2] timed out after [3009ms]
    at org.elasticsearch.transport.TransportService$TimeoutHandler.run(TransportService.java:840) ~[elasticsearch-5.0.0.jar:5.0.0]
    ... 4 more
    [2016-11-30T23:26:02,527][INFO ][o.e.c.s.ClusterService ] [node-2] new_master {node-2}{nx5b5yr6TWqxznjXv62wEA}{JC3v2euLRSerB4T7GL0Fyg}{127.0.0.1}{127.0.0.1:9301}, reason: zen-disco-elected-as-master ([0] nodes joined)
    [2016-11-30T23:26:02,588][INFO ][o.e.h.HttpServer ] [node-2] publish_address {127.0.0.1:9202}, bound_addresses {[fe80::1]:9202}, {[::1]:9202}, {127.0.0.1:9202}
    [2016-11-30T23:26:02,588][INFO ][o.e.n.Node ] [node-2] started
    [2016-11-30T23:26:02,605][INFO ][o.e.g.GatewayService ] [node-2] recovered [0] indices into cluster_state

    我无法确定我错过了哪些部分?
    如何将所有实例放入单个群集?

    最佳答案

    discovery.zen.ping.unicast.hosts接受host:port数组,此处port表示transport.tcp.port而不是http.port。因此,您的设置应如下所示:

    discovery.zen.ping.unicast.hosts: ["127.0.0.1:9302", "127.0.0.1:9303"]
    //note: 9202 became 9302 and so on

    您可以阅读有关此设置 here的更多信息。

    希望这可以帮助!

    关于elasticsearch - Elasticsearch 集群,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40894186/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com