Reference Guide

Figure 56. Edit mongod.cfg
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
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
62
Achieve high availability on MongoDB