翻译或纠错本页面

replSetMaintenance

On this page

Definition

replSetMaintenance

The replSetMaintenance admin command enables or disables the maintenance mode for a secondary member of a replica set.

The command has the following prototype form:

{ replSetMaintenance: <boolean> }

Behavior

Consider the following behavior when running the replSetMaintenance command:

  • You cannot run the command on the Primary.
  • You must run the command against the admin database.
  • When enabled replSetMaintenance: true, the member enters the RECOVERING state. While the secondary is RECOVERING:
    • The member is not accessible for read operations.
    • The member continues to sync its oplog from the Primary.
  • On secondaries, the command forces the secondary to enter RECOVERING state. Read operations issued to an instance in the RECOVERING state will fail. This prevents clients from reading during the operation. When the operation completes, the secondary returns to SECONDARY state.
  • See Replica Set Member States for more information about replica set member states.

See 对复制集节点进行维护 for an example replica set maintenance procedure to maximize availability during maintenance operations.