I was trying to add a new replica set to my mongodb sharded cluster but I keep getting the following error:

    "ok" : 0,
    "errmsg" : "Could not verify that config servers were active and reachable before write",
    "code" : 25

I checked all the config servers and they are up and running.The problem is new as I can previously add shards without any issues.

The MongoDB version I am using is 3.2 running on Ubuntu 16.02.

How can I fix this?

1 Answer 1


Managed to find the error source.

First, check the log file (eg. [Path to log)/mongod.log)

Turns out that the authentication has failed on one of the config servers. This is fixed by including " --auth --keyFile [Path to Key]" when starting up the config server mongod.

Your Answer

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

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