. . .

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.

Add all replication nodes - NOT arbiters - to apiomat.yaml comma separated:


mongodb:
hosts:dbnode1:27017,dbnode2:27017,dbnode3:27017

Setup replication node

  1. in /etc/mongodb.conf comment bind_ip out

  2. comment in noHttpInterface or comment out httpInterface

  3. comment in port

  4. add replSet=”rs0”

  5. start all nodes and check if they are working independently

  6. initiate replica set on mongo console (only on one node!) :

    mongo
    rs.initiate()
    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:

    rs.addArb("hostnameDBArbider:Port");

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
rs.reconfig(cfg);