Moving or Replacing a Member

In the shell you can use the rs.remove() helper to remove a node from a replica set.

Then use rs.add() to add the new member to the set. See rs.help() in the shell for more information.

See the Adding a New Set Member for details on how to pre-copy all the datafiles from the old member to the new member if that is desired. (The new member will automatically sync all data on its own; copying the files would only be done if the administrator wants to get the new member up and online more quickly.)

Renaming or renumbering a member's host

If you need to change a hostname or IP address that a replica set uses to refer to one of the member processes, the easiest way to do so is to run rs.reconfig() with a configuration document that preserves the member's _id number, but changes the host field. For example, if the hostname changes for the first member of the set, you might do this in the shell:

> cfg = rs.conf()
> cfg.members[0].host = newname
> rs.reconfig(cfg)

Follow @mongodb

MongoDB Pittsburgh - May 15
MongoNYC - May 23
MongoDB Paris - Jun 14
MongoDB UK - Jun 20
MongoDC - June 26


Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

PLEASE POST QUESTIONS IN THE USER GROUPS FORUM. Post non-question comments and helpful hints here.

blog comments powered by Disqus