Reference Guide

net:
bindIp: x.x.x.x, 0.0.0.0
port: 27017
security:
authorization: enabled
NOTE: The port numbers will change depending on the system at the work place.
4. Save mongod.cfg and exit.
Initiate replication on the servers
Ensure that you disable firewall on Windows and stop Tomcat servers if they are running.
1. Login to MongoDB as root user that you have already created and run the following command:
mongo -uroot -<root password> admin
2. Go to \data\bin\mongod.cfg directory, and open mongod.cfg file in a text editor.
3. Add the following three lines in the mongod.cfg file:
systemLog:
destination: file
path: c:\data\log\mongod.log
storage:
dbPath: c:\data\db\Mongo
net:
bindIp: X.X.X.X, 0.0.0.0
port: 27017
security:
authorization: enabled
keyFile: c:\data\log\mongod.key.txt
replication:
replSetName: wms
Figure 57. Enabling security
4. Create mongod.key.txt file and copy on all the three servers.
NOTE: Ensure that the mongod.key.txt file content or key is the same in all the three servers.
60 Achieve high availability on MongoDB