1. 程式人生 > >Mongo複製集叢集:Not standing for election because I cannot see a majority

Mongo複製集叢集:Not standing for election because I cannot see a majority

如果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)”