基本的弹性搜索部落设置与docker

时间:2016-12-24 15:27:46

标签: elasticsearch docker

我想做一个非常基本的设置,看看部落设置是否适用于docker。我有以下内容:

我简单运行的1节点集群:

docker run -d elasticsearch

然后我用docker inspect检查上面容器的IP。 然后我使用下面的配置运行另一个elasticsearch容器,以便它可以连接到上面的。

network.host: 0.0.0.0

tribe:
    c1:
        cluster.name: cluster1
        discovery.zen.ping.unicast.hosts: ["172.17.0.2"]

请注意,'172.17.0.2'是第一个容器的IP。当我运行这个时,我在启动时看到以下异常,它崩溃了:

[2016-12-24T17:43:14,956][WARN ][o.e.d.z.UnicastZenPing   ] [Y8QThsS/c1] [1] failed send ping to {#zen_unicast_1#}{CUKFEuPTT4CFGz5ok-7gqw}{172.17.0.2}{172.17.0.2:9300}
java.lang.IllegalStateException: handshake failed, mismatched cluster name [Cluster [elasticsearch]] - {#zen_unicast_1#}{CUKFEuPTT4CFGz5ok-7gqw}{172.17.0.2}{172.17.0.2:9300}
    at org.elasticsearch.transport.TransportService.handshake(TransportService.java:374) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.transport.TransportService.connectToNodeLightAndHandshake(TransportService.java:345) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.transport.TransportService.connectToNodeLightAndHandshake(TransportService.java:319) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.discovery.zen.UnicastZenPing$2.run(UnicastZenPing.java:473) [elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:458) [elasticsearch-5.1.1.jar:5.1.1]
    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]
[2016-12-24T17:43:17,054][WARN ][o.e.d.z.UnicastZenPing   ] [Y8QThsS/c1] [1] failed send ping to {#zen_unicast_1#}{CUKFEuPTT4CFGz5ok-7gqw}{172.17.0.2}{172.17.0.2:9300}
java.lang.IllegalStateException: handshake failed, mismatched cluster name [Cluster [elasticsearch]] - {#zen_unicast_1#}{CUKFEuPTT4CFGz5ok-7gqw}{172.17.0.2}{172.17.0.2:9300}
    at org.elasticsearch.transport.TransportService.handshake(TransportService.java:374) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.transport.TransportService.connectToNodeLightAndHandshake(TransportService.java:345) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.transport.TransportService.connectToNodeLightAndHandshake(TransportService.java:319) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.discovery.zen.UnicastZenPing$2.run(UnicastZenPing.java:473) [elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:458) [elasticsearch-5.1.1.jar:5.1.1]
    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]

我感谢任何帮助,如果我要澄清任何事情,请告诉我!

1 个答案:

答案 0 :(得分:0)

想出来!它在日志中说得对(doh!)。必须将部落配置中的群集名称与群集中设置(或假定为默认值)的内容进行匹配。

network.host: 0.0.0.0

tribe:
    c1:
        cluster.name: elasticsearch
        discovery.zen.ping.unicast.hosts: ["172.17.0.2"]