弹性搜索群集

时间:2016-11-30 17:07:15

标签: elasticsearch

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

  1. 在所有实例上更改了群集名称{cluster.name:es-stack}
  2. 在所有实例上更改了节点名称{node.name:node-1,node.name:node-2,node.name:node-3}
  3. 更改了http端口{http.port:9203,http.port:9202,http.port:9201}
  4. 更改了ping单播{discovery.zen.ping.unicast.hosts:[" 127.0.0.1:9201"," 127.0.0.1:9202"]}
  5. 实例上的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"]
    

    在我尝试启动实例时进行这些配置后,我无法获得群集环境。启动弹性搜索实例时,日志文件中的错误跟踪显示:

    [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
    

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

1 个答案:

答案 0 :(得分:2)

discovery.zen.ping.unicast.hosts包含host: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

希望这有帮助!