- Reference >
- Database Commands >
- Replication Commands >
- replSetMaintenance
replSetMaintenance¶
-
replSetMaintenance¶ The
replSetMaintenanceadmin command enables or disables the maintenance mode for a secondary member of a replica set.The command has the following prototype form:
Consider the following behavior when running the
replSetMaintenancecommand:- You cannot run the command on the Primary.
- You must run the command against the
admindatabase. - When enabled
replSetMaintenance: true, the member enters theRECOVERINGstate. While the secondary isRECOVERING:- The member is not accessible for read operations.
- The member continues to sync its oplog from the Primary.
- On secondaries, the
compactcommand forces the secondary to enterRECOVERINGstate. Read operations issued to an instance in theRECOVERINGstate will fail. This prevents clients from reading during the operation. When the operation completes, the secondary returns to:replstate:SECONDARY state. - See Replica Set Member States for more information about replica set member states.