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.


1 Answer 1


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.

  • Excellent, thanks Stennie, I've been reading your other mongodb answers for the last few days straight :)
    – mils
    Nov 7, 2017 at 22:50
  • @mils Great! Glad the answers have been helpful :)
    – Stennie
    Nov 7, 2017 at 23:08
  • I'm down to the last step of setting up my cluster - selecting a shard key :| I'm terrified of one-way operations though, so if I could pick your juicy brain one more time I would really appreciate it. Question is on SO link
    – mils
    Nov 8, 2017 at 0:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.