Changing Config Servers

Sections:

The config server data is the most important data in your entire cluster. Back it up before doing config server maintenance.

Adding and changing config servers is a bit tricky right now. This will be improved in a future release, see http://jira.mongodb.org/browse/SERVER-1658.

Note that config servers are not a replica set: instead they use a two phase commit protocol to keep their data synchronous. Thus each config server (if you have 3) has exactly the same data. When one or more config servers are down, the others are available for reading, but not for writing. During that window of time, sharding metadata will be static (which is fine for a while).

Upgrading from one config server to three

Unfortunately you will need to shutdown the entire system.

  1. Shutdown all processes (mongod, mongos, config server).
  2. Copy the data subdirectories (dbpath tree) from the config server to the new config servers.
  3. Start the config servers.
  4. Restart mongos processes with the new --configdb parameter.
  5. Restart mongod processes.

Moving your config servers - same host name or virtual ip

If you are using hostnames or virtual ips for your config, this is pretty simple.

  1. Shutdown config server you want to move
  2. Change dns entry to new machine
  3. Move data to new machine
  4. Start new config server

Renaming a config server - different host name

If you wish to use a different name or ip address in the --configdb option then this applies to you.

  1. Shutdown config server you want to move
  2. Move data to new machine
  3. Start new config server
  4. Shutdown all processes (mongod, mongos, config server).
  5. Restart mongod processes.
  6. Restart mongos processes with the new --configdb parameter.

Replacing a dead config server

Let's assume we have been running with mongos commands lines of:

mongos --configdb hosta,hostb,hostc

and that hostb has died. We want to replace it.

You cannot change the name/ip used in the mongos --configdb line; if you wish to do this you must follow the directions above for renaming or moving your servers.
  1. Provision a new machine. Give it the same hostname (hostb) that the host to be replaced had.
  2. Shut down (only) one of the other config server processes – say, hostc. Then copy its data files to hostb. (We shut down so that we know we have a consistent image of the datafiles. See also the backups page for alternatives.)
  3. Restart the config server on hostc.
  4. Start the config server for the first time on hostb.

That's it. The key above is that we reused the logical (DNS) name of the host. That way we do not have to tell the other (many) processes in the system where the config servers are.  Check the length of your DNS ttl using the dig command.


Labels

configdb configdb Delete
configserver configserver Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

PLEASE POST QUESTIONS IN THE USER GROUPS FORUM. Post non-question comments and helpful hints here.

blog comments powered by Disqus