Database Reference
In-Depth Information
Adding a new member
After creating the master node or the primary node, you can add other members, in-
cluding secondaries and arbiters to it.
So far, we have configured mongod1.replicaset.com , and now we should add
mongod2.replicaset.com and mongo3.replicaset.com to the primary ma-
chine. This process is listed in the following steps:
1. Adding a new member to an existing replica set is as easy as calling the following
command in the mongo shell:
rs.add("mongod2.replicaset.com")
2. Before running the preceding command in the first machine, you should make sure
that you have already copied the MongoDB configuration file. It's recommended
that you stop the current running mongod , copy the configuration file to the target
machine (or make it again), and then start mongod using the --config paramet-
er again.
3. After issuing the preceding command, you should see the result in the mongo shell
as shown in the following screenshot:
4. You can simply execute the rs.status() command to see the whole replica set
status each time. The following screenshot shows the status of our replica set net-
work at this step:
Search WWH ::




Custom Search