- Sharding >
- Sharded Cluster Tutorials >
- Sharded Cluster Deployment Tutorials >
- Enable Authentication in a Sharded Cluster
Enable Authentication in a Sharded Cluster¶
On this page
New in version 2.0: Support for authentication with sharded clusters.
To control access to a sharded cluster, create key files and then set
the keyFile
option on all components of the sharded
cluster, including all mongos
instances, all config server
mongod
instances, and all shard mongod
instances. The content of the key file is arbitrary but must be the
same on all cluster members.
Note
For an overview of authentication, see Access Control. For an overview of security, see Security.
Procedure¶
To enable authentication, do the following:
Generate a key file to store authentication information, as described in the Generate a Key File section.
On each component in the sharded cluster, enable authentication by doing one of the following:
Add the first administrative user and then add subsequent users. See Create a User Administrator.