三节点集群有多少master
How many master in three node cluster
我被这个问题绊倒了,在一个三节点集群中可以有多少个主节点。 I came across this point in one of a article on internet that search and index requests are not to be sent to elected master.那是对的吗?所以,如果我有三个节点作为主节点(其中一个节点被选为主节点),我是否应该指出要索引的传入日志并搜索到除选出的主节点之外的其他主节点?请提前clarify.Thanks
在三节点集群中,所有节点最有可能保存数据并且符合主节点资格。这是最简单的情况,你不用担心其他任何事情。
如果你有一个更大的集群,你可以有几个节点被配置为专用主节点。也就是说,它们符合 master 资格并且不持有任何数据。例如,您将拥有 3 个专用主节点和 7 个数据节点(不符合主节点资格)。恰好其中一个专用主节点将始终是选出的主节点。
关键在于,由于专用主节点不保存数据,因此它们不会直接服务于索引和搜索请求。如果您向他们发送索引或搜索请求,他们别无选择,只能委托给 7 个数据节点之一。
来自Elasticsearch Reference for Modules - Node:
dedicated master nodes are nodes with the settings node.data: false
and node.master: true. We actively promote the use of dedicated master
nodes in critical clusters to make sure that there are 3 dedicated
nodes whose only role is to be master, a lightweight operational
(cluster management) responsibility. By reducing the amount of
resource intensive work that these nodes do (in other words, do not
send index or search requests to these dedicated master nodes), we
greatly reduce the chance of cluster instability.
一个相关的问题是集群中应该有多少个主节点。答案本质上至少是 3,以防止脑裂(由于网络错误,同时选举两个 master 的情况)。
Elasticsearch Guide has a section on Minimum Master Nodes,摘录:
When you have a split brain, your cluster is at danger of losing data.
Because the master is considered the supreme ruler of the cluster, it
decides when new indices can be created, how shards are moved, and so
forth. If you have two masters, data integrity becomes perilous, since
you have two nodes that think they are in charge.
This setting tells Elasticsearch to not elect a master unless there
are enough master-eligible nodes available. Only then will an election
take place.
This setting should always be configured to a quorum (majority) of
your master-eligible nodes. A quorum is (number of master-eligible
nodes / 2) + 1. Here are some examples:
- If you have ten regular nodes (can hold data, can become master), a
quorum is 6.
- If you have three dedicated master nodes and a hundred data nodes, the quorum is 2, since you need to count only nodes that are master eligible.
- If you have two regular nodes, you are in a conundrum. A quorum would be 2, but this means a loss of one node will
make your cluster inoperable. A setting of 1 will allow your cluster
to function, but doesn’t protect against split brain. It is best to
have a minimum of three nodes in situations like this.
我被这个问题绊倒了,在一个三节点集群中可以有多少个主节点。 I came across this point in one of a article on internet that search and index requests are not to be sent to elected master.那是对的吗?所以,如果我有三个节点作为主节点(其中一个节点被选为主节点),我是否应该指出要索引的传入日志并搜索到除选出的主节点之外的其他主节点?请提前clarify.Thanks
在三节点集群中,所有节点最有可能保存数据并且符合主节点资格。这是最简单的情况,你不用担心其他任何事情。
如果你有一个更大的集群,你可以有几个节点被配置为专用主节点。也就是说,它们符合 master 资格并且不持有任何数据。例如,您将拥有 3 个专用主节点和 7 个数据节点(不符合主节点资格)。恰好其中一个专用主节点将始终是选出的主节点。
关键在于,由于专用主节点不保存数据,因此它们不会直接服务于索引和搜索请求。如果您向他们发送索引或搜索请求,他们别无选择,只能委托给 7 个数据节点之一。
来自Elasticsearch Reference for Modules - Node:
dedicated master nodes are nodes with the settings node.data: false and node.master: true. We actively promote the use of dedicated master nodes in critical clusters to make sure that there are 3 dedicated nodes whose only role is to be master, a lightweight operational (cluster management) responsibility. By reducing the amount of resource intensive work that these nodes do (in other words, do not send index or search requests to these dedicated master nodes), we greatly reduce the chance of cluster instability.
一个相关的问题是集群中应该有多少个主节点。答案本质上至少是 3,以防止脑裂(由于网络错误,同时选举两个 master 的情况)。
Elasticsearch Guide has a section on Minimum Master Nodes,摘录:
When you have a split brain, your cluster is at danger of losing data. Because the master is considered the supreme ruler of the cluster, it decides when new indices can be created, how shards are moved, and so forth. If you have two masters, data integrity becomes perilous, since you have two nodes that think they are in charge.
This setting tells Elasticsearch to not elect a master unless there are enough master-eligible nodes available. Only then will an election take place.
This setting should always be configured to a quorum (majority) of your master-eligible nodes. A quorum is (number of master-eligible nodes / 2) + 1. Here are some examples:
- If you have ten regular nodes (can hold data, can become master), a quorum is 6.
- If you have three dedicated master nodes and a hundred data nodes, the quorum is 2, since you need to count only nodes that are master eligible.
- If you have two regular nodes, you are in a conundrum. A quorum would be 2, but this means a loss of one node will make your cluster inoperable. A setting of 1 will allow your cluster to function, but doesn’t protect against split brain. It is best to have a minimum of three nodes in situations like this.