在 Elasticsearch 2.0 上设置多节点

Setting multi node on Elasticsearch 2.0

我开始使用 Elasticsearch 2.0。当我想在一个集群上使用多个节点时,它似乎并没有起作用。

我尝试了两种不同的方法来创建多节点。

首先,我使用本地主机创建了两个 Elasticsearch 实例。

其次,我为这个多节点使用了两台不同的计算机(一个实例在我的本地计算机上,一个实例在服务器上,我使用 discovery.zen.ping.unicast.hosts 来绑定它们)。

它与 Elasticsearch 1.x 版本不同。我读到多播已经删除。那么如何在Elasticsearch 2.0中为集群上的多节点设置配置文件呢??

这是我对不同服务器的配置设置

cluster.name: "cluster_node_1"
node.name: "test1_node1_ES2"
http.cors.enabled: true
index.number_of_shards: 5
index.number_of_replicas: 1
transport.tcp.port: 9300
http.port: 9200
http.cors.enable: true
network.bind_host: 10.21.126.151
network.publish_host: 10.21.126.151
network.host: 10.21.126.151
discovery.zen.ping.timeout: 3s
discovery.zen.ping.unicast.hosts: ["10.21.126.151", "10.21.126.145"]

谢谢

我以前遇到过同样的问题。解决方法是,

discovery.zen.ping.unicast.hosts 应该指向主节点。从你的问题来看,不清楚哪些节点是 master , data , client 等

比方说,10.21.126.151 是您的主节点,其余节点是数据节点。在所有节点中尝试以下配置

discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["10.21.126.151","[::1]"]

node.master=true will set as master node
node.master=false and node.data=true will make a nodes as data node
node.client=true will make a node as client and a client code can neither be server not be data node

我已经找到答案了。 我需要在我的配置文件中为集群中的 'other' 个节点添加端口。 所以在我的 10.21.126.151 配置文件中需要添加: discovery.zen.ping.unicast.hosts: ["10.21.126.145:9200"]