- Sharding >
- Sharded Cluster Tutorials >
- Sharded Cluster Maintenance Tutorials >
- View Cluster Configuration
View Cluster Configuration¶
List Databases with Sharding Enabled¶
To list the databases that have sharding enabled, query the
databases collection in the Config Database.
A database has sharding enabled if the value of the partitioned
field is true. Connect to a mongos instance with a
mongo shell, and run the following operation to get a full
list of databases with sharding enabled:
Example
You can use the following sequence of commands when to return a list of all databases in the cluster:
If this returns the following result set:
Then sharding is only enabled for the animals database.
List Shards¶
To list the current set of configured shards, use the listShards
command, as follows:
View Cluster Details¶
To view cluster details, issue db.printShardingStatus() or
sh.status(). Both methods return the same output.
Example
In the following example output from sh.status()
sharding versiondisplays the version number of the shard metadata.shardsdisplays a list of themongodinstances used as shards in the cluster.databasesdisplays all databases in the cluster, including database that do not have sharding enabled.- The
chunksinformation for thefoodatabase displays how many chunks are on each shard and displays the range of each chunk.