Adds a new arbiter to an existing replica set.
rs.add(<host>, true)is functionally the same as
rs.addArb(<host>). You can use these commands interchangeably.
Don't deploy more than one arbiter per replica set.
See also: Don't Deploy Multiple Arbiters
rs.addArb()method takes the following parameter:ParameterTypeDescription
hoststringSpecifies the hostname and optionally the port number of the arbiter member to add to replica set.
For the following MongoDB versions,
pv1increases the likelihood of
w:1rollbacks compared to
pv0(no longer supported in MongoDB 4.0+) for replica sets with arbiters:
MongoDB 3.2.11 or earlier
Starting in MongoDB 3.6, MongoDB binaries,
mongos, bind to localhost by default. If the
net.ipv6 configuration file setting or the
command line option is set for the binary, the binary additionally binds
to the localhost IPv6 address.
Previously, starting from MongoDB 2.6, only the binaries from the official MongoDB RPM (Red Hat, CentOS, Fedora Linux, and derivatives) and DEB (Debian, Ubuntu, and derivatives) packages bind to localhost by default.
When bound only to the localhost, these MongoDB 3.6 binaries can only
accept connections from clients (including the
other members in your deployment for replica sets and sharded clusters)
that are running on the same machine. Remote clients cannot connect to
the binaries bound only to localhost.
To override and bind to other ip addresses, you can use the
net.bindIp configuration file setting or the
--bind_ip command-line option to specify a list of hostnames or ip
For example, the following
mongod instance binds to both
the localhost and the hostname
My-Example-Associated-Hostname, which is
associated with the ip address
mongod --bind_ip localhost,My-Example-Associated-Hostname
In order to connect to this instance, remote clients must specify
the hostname or its associated ip address
mongo --host My-Example-Associated-Hostname mongo --host 198.51.100.1
When possible, use a logical DNS hostname instead of an ip address, particularly when configuring replica set members or sharded cluster members. The use of logical DNS hostnames avoids configuration changes due to ip address changes.