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?

4
  • 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
    Commented Jun 9, 2016 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
    Commented Jun 10, 2016 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
    Commented Jun 10, 2016 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
    Commented Jun 13, 2016 at 5:49

1 Answer 1

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 and acknowledge you have read our privacy policy.

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