InterviewSolution
| 1. |
What are the different backup methods MongoDB provides? |
|
Answer» We can change the configuration of the replica set as per the requirement of the application. Configuration changes may include ADDING a new member, adding Arbiter, removing a member, changing priority or votes for members, or changing member from normal secondary to hidden or delayed member. To ADD a new member, first we NEED to start the mongod process –replset option on the new server
rs.add({host: “hostname” , port : “portno.”}) Once added member will FETCH the data from primary using initial sync and replication synchronism.
rs.addArb({host: “hostname” , port : “portno.”})
rs.remove(hostname) As a good practice should shut down the member being removed before running the above command.
rs.reconfig(new config) Reconfig can be explained better with below example. Suppose we have replica set “rs0” with below configuration.
From Primary: cfg = rs.conf(); cfg.members[1].priority = 2; rs.reconfig(cfg);
|
|