Database Reference
In-Depth Information
Secondary
nodes will download and apply primary's
oplog
, that is, secondaries that
have the same dataset. As already mentioned, each replica set has one and only one
primary
node that accepts all read/write operations. If the
primary
node is unavail-
able, another
secondary
node will be the
primary
node that uses an election process.
A
secondary
node will be elected to a
primary
node if there is a clear majority vote
for a node.
Tip
By default, clients read from the
primary
node; however, clients can specify a read
preference to send read operations to secondaries at
http://docs.mongodb.org/manual/core/
To update the nodes' availability, each node sends a ping or heartbeat packets to all other
nodes. The following diagram illustrates this process:
To facilitate the election process, you can add an extra
mongod
node as an
arbiter
node.
Arbiter
nodes don't have any dataset.
Arbiter
nodes exist to vote in the elec-
tion process. They come in handy when you have an even number of nodes, so these
nodes can help you to choose the correct
secondary
node for the primary node.
Note
What is an arbiter?
Arbiter
is a
mongod
node that doesn't have any dataset and can't become a
primary
node.
Arbiter
nodes exist to vote in the election process of a
primary
node. They
don't need dedicated hardware.