Let's say I have 2 nodes in my replica set with an arbiter running. Now when it comes to adding a new member to an existing replica set while it is still running for production, what steps do I need to do to make sure the data in new node will be in sync with other nodes? Especially when the new node is a fresh mongo instance without any data.
Do I just rs.add()
new node to replica set and the data will be populated automatically? Or do I need mongodump latest data from current node then restore it to new node and do rs.add()
to let it sync anything left behind?
I am thinking to use the same strategy when I need to upgrade the mongo machine ie. prepare 2 new machines with mongo instance, add them to replica set, let the data sync, remove mongo connection to the 2 old machines, remove 2 old machines from replica, shutdown old machines leaving me with 2 new upgraded machines. Would that be the best practice while running in production to avoid 0 downtime?