1

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?

  • 1
    What version of MongoDB and (if 3.0+, what storage engine) are you using? In general you should not copy or rsync files from a running deployment as this is likely to introduce data inconsistency if files are being written to. You would be much safer reversing your first two steps: stop the existing secondary and then rsync the data files. – Stennie Jun 9 '16 at 13:49
  • @Stennie i have updated the question. My query is if i do not rsync and replace arbiter first with new machine with same host name will it rsync data from primary. Then i can go ahead with secondary with same procedure. – viren Jun 10 '16 at 4:24
  • I'm still not entirely clear what you're trying to do. Are you referring to rsync (the command line file-copying tool) or MongoDB replication initial sync? Are you replacing one member of the replica set or two (an arbiter and/or secondary)? Per my original comment, you should not use rsync on a running deployment. Initial sync is the normal process where you would rs.add() a new secondary. You cannot convert an arbiter into a secondary, as arbiters do not have any data. – Stennie Jun 10 '16 at 12:11
  • @Stennie i am not replacing Arbiter to secondary. I am removing it and adding fully data node. As per your suggestion i will use initial sync only as it will give more balanced accuracy for data. Could you please ass this as Answer so that i will close it. – viren Jun 13 '16 at 5:49
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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