In this recipe, we will be looking at how to add a node to an existing replica set.
Adding a node to the replica set
Getting ready
Ensure that you have a single node replica set running as mentioned in the first recipe of this chapter.
How to do it...
- Assuming you have the node from the previous recipe already running, open a new Terminal and start a new replica set node:
mongod --dbpath /data/server2/db --replSet MyReplicaSet --port 27018
- In another Terminal window, connect to the primary server using mongo shell (replace the IP with that of your server's):
mongo...