September 2018
Beginner to intermediate
192 pages
4h 37m
English
The first consideration is to make sure that the proposed new member of the replica set is configured for the replica set it will join, and that its mongod instance is configured to listen on the correct IP address (see the section Deploying a Replica Set, for more information).
To add a member to a replica set, you will need to run a mongo shell from the primary. You can then issue the following command:
rs.add({ host: <hostname:port> });
Where hostname is the hostname, DNS, or IP address of the new server. The port will be 27017, or whatever port was assigned when MongoDB was installed on that server:

Read now
Unlock full access