Reference Guide

2 Go to \data\bin\mongod.cfg directory, and open mongod.cfg le in a text editor.
3 Add the following three lines in the mongod.cfg le:
keyFile: c:\data\log\mongod.key.txt
replication:
replSetName: wms
Figure 27. Enabling security
4 Create mongod.key.txt le and copy on all the three servers.
Figure 28. Copy the mongod key le
5 After you copy the le, stop the mongod service by running the following command:
net stop mongodb
6 Initiate replication on the primary node of the MongoDB cluster logging in using DBadmin user and then run the following command:
rs.initiate();
7 Check the replication status by running the following command:
rs.status();
Achieve high availability on MongoDB
29