Database Reference
In-Depth Information
Adding an arbiter
An
arbiter
node doesn't store any data and only has a vote in replica set election. If you
have a replica set with an even number of members, you should add an arbiter.
Because an arbiter doesn't store data, to boost the performance of an arbiter, you can dis-
able some features safely. This can be done by performing the following steps:
1. To run an arbiter, create the
dbpath
directory first. This directory isn't used to
hold data; instead it is used to store configurations. This can be done with the fol-
lowing command line:
mkdir /data/arbiter
2. Next, run the
mongod
instance using the created
dbpath
directory:
mongod --port 20000 --dbpath /data/arbiter --replSet
rs1
Note
As in the case of
secondary
or
primary
nodes, you can use the configuration
file instead of command-line parameters to run the arbiter instance. It's recommen-
ded that you use this approach.
3. After starting the
arbiter
node, you can add it to the replica set simply by ex-
ecuting the following command in the
mongo
shell:
rs.addArb("arbiter1.replicaset.com:20000")
4. After executing the preceding command, you should see the result shown in the
following screenshot:
5. Furthermore, to check the arbiter's status, you can use the same
rs.status()
command. The following screenshot illustrates the status of our arbiter: