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
-
in /etc/mongodb.conf comment bind_ip out
-
comment in noHttpInterface or comment out httpInterface
-
comment in port
-
add replSet=”rs0”
-
start all nodes and check if they are working independently
-
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
-
set nojournal=true in mongodb.conf
-
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);