ES集群Master节点配置问题

ES集群的主节点发现机制采用单播形式,主要配置有三行,如下:

discovery.zen.minimum_master_nodes: 2
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["localhost:9001","localhost:9101","localhost:9701"]

第一行的配置说明如下:

# Discovery infrastructure ensures nodes can be found within a cluster
# and master node is elected. Multicast discovery is the default.

# Set to ensure a node sees N other master eligible nodes to be considered
# operational within the cluster. This should be set to a quorum/majority of 
# the master-eligible nodes in the cluster.
#
discovery.zen.minimum_master_nodes: 2

了解Zookeeper的话,这个配置就比较容易理解了; 数值取值为 (有资格当选为Master的节点个数/2+1), 这样做是为了防止脑裂现象, 防止某些主节点自成一个集群. 考虑到Zookeeper的一些配置, 主节点的个数最好是奇数个,并且不少于3个;但是会带来一个问题,如必须至少一半以上的主节点是可用的,如果不能满足这个要求,则系统就会崩溃.

第二行和第三行的配置说明如下:

# Unicast discovery allows to explicitly control which nodes will be used
# to discover the cluster. It can be used when multicast is not present,
# or to restrict the cluster communication-wise.
#
# 1. Disable multicast discovery (enabled by default):
#
discovery.zen.ping.multicast.enabled: false
#
# 2. Configure an initial list of master nodes in the cluster
#    to perform discovery when new nodes (master or data) are started:
#
discovery.zen.ping.unicast.hosts: ["localhost:9001","localhost:9101","localhost:9701"]

1是关闭多播,采用单播;置为false

2是给出所有的Master节点的IP和Port.端口用数据交换接口即可;

集群的节点打算分三种角色, master节点,仅充当master作用,不存储数据; data节点, 仅存储数据,不能当选为master节点; observer节点, 既不充当master,也不存储数据;

原文地址:https://www.cnblogs.com/wmx3ng/p/4707838.html