OPTIONS

Migrate Config Servers with Different HostnamesΒΆ

This procedure migrates a config server in a sharded cluster to a new server that uses a different hostname. Use this procedure only if the config server will not be accessible via the same hostname.

Changing a config server’s hostname requires downtime and requires restarting every process in the sharded cluster. If possible, avoid changing the hostname so that you can instead use the procedure to migrate a config server and use the same hostname.

To migrate all the config servers in a cluster, perform this procedure for each config server separately and migrate the config servers in reverse order from how they are listed in the mongos instances’ configdb string. Start with the last config server listed in the configdb string.

  1. Disable the cluster balancer process temporarily. See Disable the Balancer for more information.

  2. Shut down the config server to migrate.

    This renders all config data for the sharded cluster “read only.”

  3. Copy the contents of dbpath from the old config server to the new config server. For example, to copy the contents of dbpath to a machine named mongodb.config2.example.net, use a command that resembles the following:

    rsync -az /data/configdb mongodb.config2.example.net:/data/configdb
    
  4. Start the config server instance on the new system. The default invocation is:

    mongod --configsvr
    
  5. Shut down all existing MongoDB processes. This includes:

  6. Restart all shard mongod instances.

  7. Restart the mongod instances for the two existing non-migrated config servers.

  8. Update the configdb setting for each mongos instances.

  9. Restart the mongos instances.

  10. Re-enable the balancer to allow the cluster to resume normal balancing operations. See the Disable the Balancer section for more information on managing the balancer process.