Starting in MongoDB 8.0, you can configure a config server to store your application data in addition to the usual sharded cluster metadata. A mongod node that provides both config server and shard server functionality is called a config shard. A mongod node that runs as a standalone --configsvr without shard server functionality is called a dedicated config server.
A sharded cluster must have a config server, but it can be either a config shard (embedded config server) or a dedicated config server. Using a config shard reduces the number of nodes required and can simplify your deployment. A config shard cluster is also called an embedded config server cluster. You cannot use the same config server for multiple sharded clusters.
Use Cases
A config shard costs less than a dedicated config server because a dedicated config server runs as its own replica set. A config shard combines the config server role into an existing shard's replica set, so your cluster needs one replica set instead of two. Using a config shard has no measurable performance impact at low shard counts. A dedicated config server isolates cluster metadata from application data, which certain features require.
Use a dedicated config server if you use one or more of the following features:
Queryable Encryption collections
Queryable backups (on-prem)
On MongoDB Atlas, a cluster automatically transitions from a config shard to a dedicated config server when the cluster has more than five shards.
Behavior
In an embedded config server cluster, a config shard will be used to store cluster metadata and user data. It helps reduce the complexity of a sharded cluster deployment.
You can store sharded and unsharded collection data in your config shard. It has all the properties of a shard as well as acting as the config server.
Confirm use of Config Shard
You can confirm that a sharded cluster uses a config shard by using one of the following methods:
Run the
sh.isConfigShardEnabled()method inmongosh. If thesh.isConfigShardEnabled()output containsenabled: true, the cluster uses a config shard. If the output containsenabled: false, the cluster does not use a config shard.Run the
listShardscommand against theadmindatabase while connected to amongosand inspect the output for a document where_idis set to"config". If thelistShardsoutput does not contain a document where_idis set to"config", the cluster does not use a config shard.
The following example runs the listShards command and tries to find a document where _id is set to "config".
db.adminCommand({ listShards: 1 })["shards"].find(element => element._id === "config")
In this example, the returned document has _id set to "config" which confirms that this cluster uses a config shard.
{ _id: "config", host: "configRepl/localhost:27018", state: 1, topologyTime: Timestamp({ t: 1732218671, i: 13 }), replSetConfigVersion: Long('-1') }
Commands
To configure a dedicated config server to run as a config shard, run the transitionFromDedicatedConfigServer command.
To configure a config shard to run as a dedicated config server, run the transitionToDedicatedConfigServer command.