Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MongoDB replica set member status

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Replica set member status

Each member of the replica set has a state that reflects its configuration in the collection.

Figures

Name

State description

0

STARTUP

Is not yet an active member of any collection. All members start in that state. Parse the replica set configuration document in the STARTUP status mongod.

one

PRIMARY

Members in the PRIMARY state are the only ones that can accept writes.

two

SECONDARY

Members in the SECONDARY state replicate the data store. The data can be used for reading, although it may be old.

three

RECOVERING

You can vote. Members either implement a conversion that starts self-detection or completes a rollback or resynchronization.

five

STARTUP2

Member joined the collection and is running initialization synchronization.

six

UNKNOWN

The status of the member, as seen from another member of the collection, is unknown.

seven

ARBITER

Arbitration does not copy data, but only participates in elections.

eight

DOWN

The member, as you can see immediately from the collection with a member, is unreachable.

nine

ROLLBACK

The member is implementing a rollback. The data is not readable.

ten

REMOVED

The member was in the replica set but was subsequently removed.

Status

Core state

PRIMARY

Members in the PRIMARY state accept write operations. A replica set has at most one primary member at a time. After an election, a SECONDARY status member becomes the principal member. Members in the PRIMARY state are eligible to be elected.

SECONDARY

Members in the SECONDARY state replicate the data collection of the master member and can be configured to accept read operations. Auxiliary members are eligible to vote in the election, and if the primary member is not available, they will be elected to the PRIMARY status.

ARBITER

Members in the ARBITER state do not copy data and do not accept write operations. They are eligible to vote, and they only exist in the election. If the collection either has a large number of members and can participate in the run-off election, otherwise only one member of the replica set should be in the ARBITER state. At most one arbitration is configured in any replica set.

Check out the replica set members for more information about the core state.

Other statu

STARTUP

Each member of the replica set starts in a STARTUP state. The Mongod then loads the replica set configuration of the member, and the state of the member is transformed to STARTUP2. Members in the STARTUP state are not eligible to be elected because they are not considered members of any replica set.

STARTUP2

Once the mongod loads the member configuration, each member of the replica set enters the STARTUP2 state, where it starts an active member of the member replica set. Members then decide whether synchronization needs to be initialized. If a member starts initializing synchronization, the member remains in a STARTUP2 state until all data copies are complete and all indexes are created. After that, the member transitions to RECOVERING state.

RECOVERING

When a replica set member is not ready to be read, it enters the RECOVERING state. The RECOVERING state occurs during normal operation and it is not necessary to display an error condition. Members in the RECOVERING state are eligible to vote in the election, but are not eligible to enter the PRIMARY state.

After copying enough data to the consistent view that the client needs to read the data, the member changes from the RECOVERING state to the SECONDARY state. The only difference between the RECOVERING and SECONDARY states is that RECOVERING prevents the client from reading and SECONDARY runs the read. SECONDARY status does not guarantee that master member data is obsolete.

With regard to load, a secondary member may lag far behind other members of the replica set, so much so that it may need to be resynchronized to the replica set. When this happens, the member enters the RECOVERING state and requires manual intervention.

Error statu

Members in the wrong state cannot be elected.

UNKNOWN

Members who have never communicated status information to the replica set will be in the UNKNOWN state.

DOWN

Members that have lost connections to the replica set are treated as DOWN states by the remaining members of the collection.

REMOVED

Members removed from the replica set enter the REMOVED state. When a member enters the REMOVED state, the log marks the replset REMOVED message event.

ROLLBACK

When the replica set replaces the primary member in an election, the old primary member may contain documents that will not be copied to the secondary member. In this case, the old master member reverses these writes. During the rollback, the member remains in the ROLLBACK state.

FATAL

An unrecoverable error was triggered by a member in the FATAL state. Members must shut down and restart, and may also need to resynchronize.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report