The following steps are necessary to setup a basic MongoDB Replication in use with ApiOmat.
Please read the original manual for more information.
Once YAMBAS installed, add all replication nodes - NOT arbiters - to apiomat.yaml comma separated:
Setup replication node
In /etc/mongodb.conf of each replication member, set bindIp=0.0.0.0
If /etc/mongodb.conf contain noHttpInterface, remove its comment
If /etc/mongodb.conf contain httpInterface, put it in comment.
If port is commented, remove the comment
Remove comment from replication and add property replication.replSetName: ”rs0”mongod.conf
Start all nodes and check if they are working independently
Test connection between all members (from https://docs.mongodb.com/v3.6/tutorial/troubleshoot-replica-sets/) :
Given a replica set with three members running on three separate hosts: m1.example.net m2.example.net m3.example.net All three use the default port 27017. Test the connection from m1.example.net to the other hosts with the following operation set m1.example.net: > mongo --host m2.example.net --port 27017 > mongo --host m3.example.net --port 27017 Test the connection from m2.example.net to the other two hosts with the following operation set from m2.example.net, as in: > mongo --host m1.example.net --port 27017 > mongo --host m3.example.net --port 27017 You have now tested the connection between m2.example.net and m1.example.net in both directions. Test the connection from m3.example.net to the other two hosts with the following operation set from the m3.example.net host, as in: > mongo --host m1.example.net --port 27017 > mongo --host m2.example.net --port 27017 If any connection, in any direction fails, check your networking and firewall configuration and reconfigure your environment to allow these connections.
Initiate replica set on mongo console (only on the primary node !) :
//add each node
Setup arbider node
Set nojournal=true in mongodb.conf
Initiate arbider on mongo console:
Usually, it is a good idea to increase the priority of the node, which should be master under normal circumstances. That way, you do not have to query the set for the current master each time.
cfg = rs.conf()
cfg.members[x].priority = y