. . .

Setup Replication

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:


default: dbnode1:27017,dbnode2:27017,dbnode3:27017

Setup replication node

  1. In /etc/mongodb.conf of each replication member, set bindIp=

  2. If /etc/mongodb.conf contain noHttpInterface, remove its comment

  3. If /etc/mongodb.conf contain httpInterface, put it in comment.

  4. If port is commented, remove the comment

  5. Remove comment from replication and add property replication.replSetName: ”rs0”

    replSetName: "rs0"

  6. Start all nodes and check if they are working independently

  7. 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:
    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.
  8. Initiate replica set on mongo console (only on the primary node !) :


    rs.conf() //shows config
    rs.add("hostnameDBNodeX:Port") //add each node
    rs.status(); //check status

Setup arbider node

  1. Set nojournal=true in mongodb.conf

  2. Initiate arbider on mongo console:



Setup priority

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