If you're trying to rs.reconfigure() or rs.initiate() and you get the following error:
Cannot run replSetReconfig because the node is currently updating its configuration
And you can't seem to find any other solution, try this hack on each node of the replica set:
- SSH to the first node
- Edit Mongo's configuration file:
sudo vi /etc/mongod.conf - Comment out the replicaset config block
- Restart mongo:
sudo service mongod restart - Open Mongo Shell:
mongo - Run the following commands:
use local
db.system.replset.remove({})
- Open the file from step 2 again
- Remove the comments from step 3
- Restart mongo:
sudo service mongod restart - Repeat the process on all nodes
After you're done, run the rs.reconfigure() or rs.initiate() commands, e.g:
rs.initiate({_id: "<replicaSetName>",version: 1,members: [{ _id: 0, host : "X:27017" },{ _id: 1, host : "Y:27017" },{ _id: 2, host : "Y:27017" }]},{force:true})