- Sharding >
- Sharded Cluster Administration >
- Sharded Cluster Config Server Administration >
- Upgrade Config Servers to Replica Set (Downtime)
Upgrade Config Servers to Replica Set (Downtime)¶
On this page
Important
In version 3.4, MongoDB removes support for SCCC config servers. Before you can upgrade your sharded clusters to 3.4, you must convert your config servers from SCCC to CSRS. To convert to CSRS, follow the procedure to change your 3.2.x SCCC to 3.2.x CSRS.
The following procedure upgrades three mirrored config servers to a config server replica set.
Prerequisites¶
- All binaries in the sharded clusters must be at least version 3.2. See Upgrade a Sharded Cluster to 3.2 for instructions to upgrade the sharded cluster.
- The existing config servers must be in sync.
Procedure¶
Important
The procedure outlined in this tutorial requires downtime. If all the sharded cluster binaries are at least version 3.2.4, you can also convert the config servers to replica set without downtime. For details, see Upgrade Config Servers to Replica Set.
Disable the balancer as described in Disable the Balancer.
Connect a
mongoshell to the first config server listed in theconfigDBsetting of themongosand runrs.initiate()to initiate the single member replica set._idcorresponds to the replica set name for the config servers.versionset to 1, corresponding to the initial version of the replica set configuration.configsvrmust be set betrue.membersarray contains a document that specifies:members._idwhich is a numeric identifier for the member.members.hostwhich is a string corresponding to the config server’s hostname and port.
Restart this config server as a single member replica set with:
- the
--replSetoption set to the replica set name specified during thers.initiate(), - the
--configsvrModeoption set to the legacy config server mode Sync Cluster Connection Config (sccc), - the
--configsvroption, and - the
--storageEngineoption set to the storage engine used by this config server. For this upgrade procedure, the existing config server can be using either MMAPv1 or WiredTiger.
Include additional options as specific to your deployment.
Or if using a configuration file, specify the
replication.replSetName:,sharding.clusterRole,sharding.configsvrModeandnet.port.- the
Start the new
mongodinstances to add to the replica set. These instances must use the WiredTiger storage engine. Starting in 3.2, the default storage engine is WiredTiger for newmongodinstances with new data paths.Important
- Do not add existing config servers to the replica set.
- Use new dbpaths for the new instances.
The number of new
mongodinstances to add depends on the config server currently in the single-member replica set:- If the config server is using MMAPv1, start 3 new
mongodinstances. - If the config server is using WiredTiger, start 2 new
mongodinstances.
Note
The example in this procedure assumes that the existing config servers use MMAPv1.
For each new
mongodinstance to add, include the--configsvrand the--replSetoptions:Or if using a configuration file:
Using the
mongoshell connected to the replica set config server, add the newmongodinstances as non-voting, priority 0 members:Once all the new members have been added as non-voting, priority 0 members, ensure that the new nodes have completed the initial sync and have reached
SECONDARYstate. To check the state of the replica set members, runrs.status()in themongoshell:Shut down one of the other non-replica set config servers; i.e. either the second and third config server listed in the
configDBsetting of themongos.Reconfigure the replica set to allow all members to vote and have default priority of
1.Step down the first config server, i.e. the server started with
--configsvrMode=sccc.Shut down the following members of the sharded cluster:
- The
mongosinstances. - The shards.
- The remaining non-replica set config servers.
- The
Shut down the first config server.
If the first config server uses the MMAPv1 storage engine, remove the member from the replica set. Connect a
mongoshell to the current primary and users.remove():Important
If the first config server uses the WiredTiger storage engine, do not remove.
If the first config server uses WiredTiger, restart the first config server in config server replica set (
CSRS) mode; i.e. restart without the--configsvrMode=scccoption:Important
If the first config server uses the MMAPv1 storage engine, do not restart.
Or if using a configuration file, omit the
sharding.configsvrModesetting:Restart the shards.
Restart
mongosinstances with updated--configdborconfigDBsetting.For the updated
--configdborconfigDBsetting, specify the replica set name for the config servers and the members in the replica set.Re-enable the balancer as described in Enable the Balancer.