This chapter covers replica set administration, including:
Techniques for performing maintenance on individual members
Configuring sets under a variety of circumstances
Getting information about and resizing your oplog
Doing some more exotic set configurations
Converting from master-slave to a replica set
A lot of maintenance tasks cannot be performed on secondaries (because they involve writes) and shouldn’t be performed on primaries because of the impact this could have on application performance. Thus, the following sections frequently mention starting up a server in standalone mode. This means restarting the member so that it is a standalone server, not a member of a replica set (temporarily).
To start up a member in standalone mode, first look at the command line argument. Suppose it looks something like this:
To perform maintenance on this server we can restart it without the
replSet option. This will allow us to read and write to it as a normal
standalone mongod. We don’t want the other servers in the
set to be able to contact it, so we’ll make it listen on a different port (so that the other
members won’t be able to find it). Finally, we want to keep the
dbpath the same, as we are presumably starting it up this way to manipulate the server’s data somehow. ...