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.
To add an arbiter to an existing replica set:
- Typically, if there are two or fewer data-bearing members in the replica set, you might need to first set the cluster wide write concern for the replica set.
- See cluster wide write concern for more information on why you might need to set the cluster wide write concern.
You do not need to change the cluster wide write concern before starting a new replica set with an arbiter.TipSee also:
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.4.1
- MongoDB 3.4.0
- MongoDB 3.2.11 or earlier
to localhost by default. If the
net.ipv6 configuration file
setting or the
--ipv6 command line option is set for the binary,
the binary additionally binds to the localhost IPv6 address.
mongos that are
bound to localhost only accept connections from clients that are
running on the same computer. This binding behavior includes
mongosh and other members of your replica set or sharded
cluster. Remote clients cannot connect to binaries that are bound only
To override the default binding and bind to other IP addresses, use the
net.bindIp configuration file setting or the
command-line option to specify a list of hostnames or IP addresses.
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
mongosh --host My-Example-Associated-Hostname mongosh --host 198.51.100.1
To avoid configuration updates due to IP address changes, use DNS hostnames instead of IP addresses. It is particularly important to use a DNS hostname instead of an IP address when configuring replica set members or sharded cluster members.
Use hostnames instead of IP addresses to configure clusters across a split network horizon. Starting in MongDB 5.0, nodes that are only configured with an IP address will fail startup validation and will not start.