如果Mongo复制集集群挂掉的节点数(Arbiter也算作一个普通节点)达到总节点数的一半,则剩余节点无法选举新的Primary,并且会在日志里记录“Not starting an election, since we are not electable due to: Not standing for election because I cannot see a majority (mask 0x1)”。即便是剩余节点里有Arbiter存在,也无法选举新的Primary。
验证试验如下:
1台Primary,4台Secondary,1台Arbiter
- Primary和Arbiter同时挂了
- 4台Secondary会自动选出一个Primary,暂时没有发现有平局而选不出的情况
- Primary,Arbiter和一个Secondary同时挂,达到总节点数的一半
- 3台Secondary无法自动选出一个Primary,日志中会报“Not starting an election, since we are not electable due to: Not standing for election because I cannot see a majority (mask 0x1)”
- Primary和2个Secondary同时挂,达到总节点数的一半
- 2台Secondary无法自动选出一个Primary,日志中会报“Not starting an election, since we are not electable due to: Not standing for election because I cannot see a majority (mask 0x1)”