MongoDB ReplicaSet Configuration
This document is not needed for release 3.16.x and above. The MongoDB replication and priority setup has been automated during deployment.
If you are following manual procedure of HA Deployment (as in 3.10.2), please refer to the initial configuration manual for setting up "Mongo DB Replication" from (3.15 ) MongoDB ReplicaSet Configuration (3.10.2)
This document describes procedure to verify the MongoDB replica set configurations and steps to configure.
Master Node
Once deployment is completed, please execute the mongo-replication-primary.sh
script on master node to initialise and configure the mongo DB replication.
# change directory to the deployment path i-e /var/lib/expertflow or any other path selected during deployment
$ cd /var/lib/expertflow
$ bash mongo-replication-primary.sh
Once the script execution is completed, please login to the mongo DB service container using efutils
and perform below given procedure to ensure the master node is always selected as PRIMARY node in election and recovery after failures.
#use the ufutils utility to login to the mongo service container
$ efutils login
# select the mongo container or number
# then enter mongo command to enter the mongo shell
$ mongo
# execute these commands to ensure the master node's priority is always prefered.
# NOTE: these commands must be executed on the Master node only
ef:PRIMARY> cfg = rs.conf()
ef:PRIMARY> cfg.members[0].priority = 1
ef:PRIMARY> cfg.members[1].priority = 0.5
ef:PRIMARY> rs.reconfig(cfg)
Slave Node
After completing the deployment on Slave node, please use the mongo-replication-secondary.sh
script to enable replication.
# change to the deployment path i-e /var/lib/expertflow or any other path selected during deployment
$ bash mongo-replication-secondary.sh
Arbiter Node
No special instructions are needed for arbiter node.