Shard cluster management

You can display information about shard cluster participants and about the shard cache on each shard server. You can add or remove shard servers from a shard cluster.

To display information about shard cluster participants, run the db.runCommand from the MongoDB shell, with listShard command syntax.

To display information about shard caches, run the onstat -g shard command.

Add a shard server

To add a shard server to the shard cluster, prepare the new shard server and add it to the shard cluster with the addShard command. Make sure to add the trusted host information for the new shard server to the existing shard servers.

Remove a shard server

To remove a shard server, run the db.runCommand from the MongoDB shell, with removeShard command syntax.

Change the sharding definition

After you add or remove a shard server, you might need to update the sharding definition:

  • A definition that uses a hash algorithm to shard data is modified automatically.
  • You must modify a sharding definition that uses an expression by running the changeShardCollection command.

When you change the sharding definition, existing data on shard servers is redistributed to match the new definition.