3.a Connect to any of the mongod servers via the mongo shell. To do that open the command prompt and type.
Once connected to the mongo shell, create a config object
this config object has 2 attributes
1. _id: the name of the replica Set ( "s0" )
2. members: [] (members is an array of mongod instances. lets keep this blank for now, we will add members via the push command.
3.b To Push(add) mongod instances to the members array in the config object. On the mongo shell type
We assign each mongod instance an _id and an host. _id can be any unique number and the host should be the hostname of the server on which its running followed by the port number.
4. Initiate the config object by the following command in the mongo shell.
5. Give it a few seconds and we have a replica set of 3 mongod instances running on the server. type the following command to check the status of the replica set and to identify which one is primary and which one is secondary.
Anil Bist
Skills Mongodb
Qualifications :- High School - SLV, College/University - Graphic Era Deemed Univ University,Location :-Dehradun,Dehradun,Uttarakhand,India
Description:-
I started my Professional Journey in 2006 with one of the Web Development Company in Bangalore and my 1st framework was "Ruby on Rail" as Web development and delivered around 5+ Projects using this platform. Then came another dimension as JEE/Sturst framework, Gradually I realized that I want to build something on my own and give my passion and energy on creating something different a
Explore