如何在不同的计算机上运行elasticsearch服务器?

时间:2016-08-01 02:21:30

标签: elasticsearch

我有两台计算机A(192.168.0.224)和B(192.168.0.123),每台计算机上都有一台ES服务器。在A:

上配置文件elasticsearch.yml
cluster.name: elasticssearch
node.name: node-1

network.host: 0.0.0.0


discovery.zen.ping.unicast.hosts: 192.168.0.224:9200,192.168.0.123:9200


index.analysis.analyzer.default.type: ik

script.engine.groovy.inline.update: on 
script.engine.groovy.inline.search: on 

index.mapper.dynamic : false

在B上配置文件elasticsearch.yml

cluster.name: elasticssearch
node.name: node-2

network.host: 0.0.0.0


discovery.zen.ping.unicast.hosts: 192.168.0.224:9200,192.168.0.123:9200


index.analysis.analyzer.default.type: ik

script.engine.groovy.inline.update: on 
script.engine.groovy.inline.search: on 

index.mapper.dynamic : false

我启动ES服务器并获取错误信息:

    [2016-08-01 10:05:42,683][WARN ][discovery.zen.ping.unicast] [node-2] failed to send ping to [{#zen_unicast_2#}{192.168.0.224}{192.168.0.224:9200}]
ReceiveTimeoutTransportException[[][192.168.0.224:9200][internal:discovery/zen/unicast] request_id [1] timed out after [3750ms]]
    at org.elasticsearch.transport.TransportService$TimeoutHandler.run(TransportService.java:679)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

如何正确运行不同计算机上的elasticsearch服务器?

1 个答案:

答案 0 :(得分:2)

discovery.zen.ping.unicast.hosts属性需要稍微调整,即您需要指定TCP端口(默认为9300)而不是HTTP端口9200:

discovery.zen.ping.unicast.hosts: 192.168.0.224:9300,192.168.0.123:9300

您也可以省略端口,使其占用默认的TCP端口(9300),您不必担心它:

discovery.zen.ping.unicast.hosts: 192.168.0.224,192.168.0.123