InterviewSolution
| 1. |
Why is it so important to choose the right shard key for sharding? |
|
Answer» There are a few key differences while setting authentication on the sharded cluster. To set up authentication we should connect to mongos instead of mongod. Also, clients who want to authenticate to the sharded cluster MUST do from mongos. Ensure sharded cluster has at least two mongos instances available as it requires restarting each mongos in the cluster. If the sharded cluster has only one mongos instance, this results in downtime during the period that the mongos is offline.
security: transitionToAuth: true keyFile: <path-to-keyfile>The new configuration file should contain all of the configuration settings previously used by the mongos as well as the new security settings.
Connect to the primary member of each shard replica set and create a user with the db.createUser() method. db.createUser({ user: "admin1", pwd: "<password>", roles: [ { role: "clusterAdmin", db: "admin" }, { role: "userAdmin", db: "admin" }]});This user can be used for maintenance activities on individual shards.
|
|