Mongodb – different keyfiles for different replica sets

mongodbreplicationsharding

I am building a cluster using mongodb (3.4). Can I use separate keyfiles for my configuration replica set and my shard replica sets? Judging by the documentation (https://docs.mongodb.com/v3.2/tutorial/enforce-keyfile-access-control-in-existing-replica-set/), it seems possible but I'm not sure.

Thanks

Best Answer

The keyfile is used to secure intra-cluster communication, so all components of a sharded cluster (mongod and mongos) must use the same keyfile.

The documentation you referenced is for a single replica set deployment. For a sharded cluster see: Enforce Keyfile Access Control in Sharded Cluster.