Database Reference
In-Depth Information
most circumstances has the previous primary step back into its role. Now if we re-run the rs.conf() command you
can see your new replica set configuration in action.
> rs.conf()
{
"_id" : "testset",
"version" : 4,
"members" : [
{
"_id" : 0,
"host" : "[hostname]:27021"
},
{
"_id" : 1,
"host" : "[hostname]:27022"
},
{
"_id" : 2,
"host" : "[hostname]:27023",
"priority" : 0,
"hidden" : true
}
]
}
Notice that this replica set configuration's version number has now increased. This happens automatically as part
of the reconfiguration to ensure that any replica set members don't have the wrong configuration document.
You should now have a fully configured and working three-member replica set with an active primary and a
hidden “passive.”
Adding an Arbiter
Adding an arbiter to be a voting member of your replica set is an easy process. Let's start by spinning up a
new member.
$ mkdir -p /db/arbiter1/data
$ mongod --dbpath /db/ arbiter1/data --port 27024 --replSet testset -rest
Now that you have a new member created, it's just a matter of adding the new arbiter with the rs.addArb()
command:
>rs.addArb("[hostname]:27024")
{ "ok" : 1 }
And if you now run rs.status() , you will see your arbiter in the output:
{
"_id" : 3,
"name" : "Pixl.local:27024",
"health" : 1,
"state" : 7,
 
Search WWH ::




Custom Search