Database Reference
In-Depth Information
getLastErrorModes —A document defining extra modes for the getLastError
command. This feature is dependent on replica set tagging and is described in
detail in section 8.4.4.
R EPLICA SET STATUS
You can see the status of a replica set and its members by running the replSetGet-
Status command. To invoke this command from the shell, run the rs.status()
helper method. The resulting document indicates the extant members and their
respective states, uptime, and oplog times. It's important to understand replica set
member state; you can see a complete list of possible values in table 8.1.
You can consider a replica set stable and online when all its nodes are in any of
states 1, 2, or 7 and when at least one node is running as the primary. You can use the
replSetGetStatus command from an external script to monitor overall state, replica-
tion lag, and uptime, and this is recommended for production deployments. 8
Table 8.1
Replica set states
State
State string
Notes
0
Indicates that the replica set is negotiating with other nodes by pinging
all set members and sharing config data.
STARTUP
1
This is the primary node. A replica set will always have at most one pri-
mary node.
PRIMARY
2
This is a secondary, read-only node. This node may become a primary in
the event of a failover if and only if its priority is greater than 0 and it's
not marked as hidden.
SECONDARY
3
This node is unavailable for reading and writing. You usually see this
state after a failover or upon adding a new node. While recovering, a
data file sync is often in progress; you can verify this by examine the
recovering node's logs.
RECOVERING
4
A network connection is still established, but the node isn't responding
to pings. This usually indicates a fatal error on the machine hosting the
node marked FATAL .
FATAL
5
An initial data file sync is in progress.
STARTUP2
6
A network connection has yet to be made.
UNKNOWN
7
This node is an arbiter.
ARBITER
8
The node was accessible and stable at some point but isn't currently
responding to heartbeat pings.
DOWN
9
A rollback is in progress.
ROLLBACK
8
Note that in addition to running the status command, you can get a useful visual through the web console.
Chapter 10 discusses the web console and shows an example of its use with replica sets.
 
Search WWH ::




Custom Search