Mongodb – Replacing a member of a replica set with the same host name

mongodbreplication

I am replacing a member of a replica set (the new member has a different IP address).

What I am looking to do is as follows:

  • RSYNC the data directory of the existing secondary node to the new node.
  • Stop the existing node.
  • Map the existing hostname to the IP of the new node.
  • Start MongoDB on this new node with the replica set.

Mongo Version 3.2 and storage engine MMapV1

it is 3 member replica set.

Primary
Secondary
Arbiter
My plan is to first replace arbiter with a new secondary node then. Do the procedure with on existing secondary node to replace this also.

Could someone please verify if the above steps make sense?

Best Answer

I think you can get what you want if you first rs.add() the new secondary, and when it's done you rs.remove() the arbiter.

There will be a brief period of thime with 4 nodes, howerever.