• shards displays a list of the mongod instances used as shards in the cluster. 

• databases displays all databases in the cluster, including database that do not have sharding enabled. 

• The chunks information for the foo database displays how many chunks are on each shard and displays the range of each chunk. 

--- Sharding Status --- sharding version: { "_id" : 1, "version" : 3 } shards: { "_id" : "shard0000", "host" : "m0.example.net:30001" } { "_id" : "shard0001", "host" : "m3.example2.net:50000" } databases: { "_id" : "admin", "partitioned" : false , "primary" : "config" } { "_id" : "contacts", "partitioned" : true , "primary" : "shard0000" } foo.contacts shard key: { "zip" : 1 } chunks: shard0001 2 shard0002 3 shard0000 2 { "zip" : { "$minKey" : 1 } } -->> { "zip" : "56000" } on : shard0001 { "t" : 2 { "zip" : 56000 } -->> { "zip" : "56800" } on : shard0002 { "t" : 3, "i" : 4 } { "zip" : 56800 } -->> { "zip" : "57088" } on : shard0002 { "t" : 4, "i" : 2 } { "zip" : 57088 } -->> { "zip" : "57500" } on : shard0002 { "t" : 4, "i" : 3 } { "zip" : 57500 } -->> { "zip" : "58140" } on : shard0001 { "t" : 4, "i" : 0 } { "zip" : 58140 } -->> { "zip" : "59000" } on : shard0000 { "t" : 4, "i" : 1 } { "zip" : 59000 } -->> { "zip" : { "$maxKey" : 1 } } on : shard0000 { "t" : 3, "i" : 3 } { "_id" : "test", "partitioned" : false , "primary" : "shard0000" } 

## Migrate Config Servers with the Same Hostname 

This procedure migrates a config server (page 670) in a sharded cluster (page 667) to a new system that uses 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. Shut down the config server. 

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

2. Change the DNS entry that points to the system that provided the old config server, so that the same hostname points to the new system. How you do this depends on how you organize your DNS and hostname resolution services. 

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 , you might issue a command similar to 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 

When you start the third config server, your cluster will become writable and it will be able to create new splits and migrate chunks as needed. 

