Hello.
I have a three server replica cluster working fine for 3 years. Mongo 2.6.10. Replica were designated using IP instead of hostname :(
AWS rebooted all three servers and all received new IP addresses. Leaving replication broken.
To continue service immediately, I commented out `replSet = testReplSet` on the known primary, restarted, and pointed the web servers to this single server. Effectively putting it in stand-alone mode.
Now it is time to re-establish replication.
Can I fix the IP address of the primary in the replica set, re-enable `replSet = testReplSet`, restart mongo, and will it resume the role of primary? ( After which I will add new secondaries)
---------------------------------------------
1) UPDATE THE IP ADDRESS (JUST FOR THE PRIMARY _id=0)
Suppose we have a configuration such as the one shown here:
> rs.config() { "_id" : "testReplSet", "version" : 2, "members" : [ { "_id" : 0, "host" : "
10.35.1.10: 27017" }, { "_id" : 1, "host" : "
10.35.1.11: 27017" }, { "_id" : 2, "host" : "
10.35.1.12: 27017" } ] }
Can I load the current configuration in the shell and then change the relevant IP:
> var config = rs.config()
> config.members[ 1]. host = "
10.35.2.10: 27017"
Then send it to the database using the rs.reconfig helper:
> rs.reconfig( config)
2) MODIFY /etc/mongodb.conf
Enable `replSet = testReplSet`
3) RESTART MONGO
---------------------------------------------
Will this trigger mongodb and this server into resuming the role of primary?
If not, what are other options?
Thanks
Geoff