最近写MongoDB监控脚本,要判断节点状态,这里整理了所有的节点状态值,对应 命令 rs.status().members 中的 state 和 stateStr 字段,如:
"state" : 3,
"stateStr" : "RECOVERING"
0 | Not yet an active member of any set. All members start up in this state. The parses the while in . | |
1 | The member in state is the only member that can accept write operations. Eligible to vote. | |
2 | A member in state is replicating the data store. Eligible to vote. | |
3 | Members either perform startup self-checks, or transition from completing a or . Eligible to vote. | |
5 | The member has joined the set and is running an initial sync. Eligible to vote. | |
6 | The member’s state, as seen from another member of the set, is not yet known. | |
7 | do not replicate data and exist solely to participate in elections. Eligible to vote. | |
8 | The member, as seen from another member of the set, is unreachable. | |
9 | This member is actively performing a . Eligible to vote. Data is not available for reads from this member. | |
10 | This member was once in a replica set but was subsequently removed. |