add an arbiter in a mongodb replica set
An arbiter is a mongodb instance that don’t store a copy of data set and cannot become a primary. It has exactly 1 vote election when it comes to picking a primary instance in the replicat set. Usually you only add an arbiter instance to an existing replicat set that has even number of mongodb instances. By adding an arbiter instance, it allows the replicat set to have an uneven number of mongodb instances to avoid running into a tied situation when doing the election of picking a primary.
Create a folder for the arbiter. It will hold the configuration data only since arbiter don’t contain data.
Start the arbiter by specifing the data folder and the replicat set name.
mongodb --port 28000 --dbpath /data/arb --replet replicatSet
Connect to the primary and add the arbiter to the replica set by using the rs.addArb() function.
Search within Codexpedia
Search the entire web