Database Reference
In-Depth Information
Table 11-4. ( continued )
Option
Description
members.$.arbiterOnly (Optional) Boolean: This member operates as an arbiter for electing new primary
servers. It is not involved in any other function of the replica set, and it does not need to
have been started with a --replSet command-line option. Any running mongod process
in your system can perform this task. The default value of this element is false .
members.$.votes (Optional) Integer: This element specifies the number of votes the instance can cast to
elect other instances as a primary server; the default value of this element is 1 .
members.$. hidden (Optional) Boolean: This hides the node from the output of db.isMaster() and so
prevents read operations from occurring on the node, even with a secondary read
preference.
members.$.tags (Optional) Document: This allows you to set the tags for replica set tagged read
preferences.
members.$.slaveDelay (Optional) Integer: This allows you to set the slave to be “delayed” a specified number of
seconds behind the primary.
members.$.buildIndexes (Optional) Boolean: This option is used to disable the building of indexes. It should
never bet set on a node that can theoretically become primary. This capability can be
useful for backup nodes and the like when indexes are unimportant and you wish to
save space.
Exploring the Options Available in the Settings Structure
Table 11-5 lists the replica set properties available in the Settings structure. These settings are applied globally to the
entire replica set; you use these properties to configure how replica set members communicate with each other.
Table 11-5. Inter-server Communication Properties for the Settings Structure
Option
Description
settings.chainingAllowed (Optional) Boolean: Allows you to specify if the member is allowed to replicate
from other secondaries. Defaults to true
settings.getLastErrorModes (Optional) Modes: Used in setting custom write concerns, as described later in
this chapter.
Settings.getLastErrorDefaults (Optional) Defaults: Used in setting custom write concerns
Connecting to a Replica Set from Your Application
Connecting to a replica set from PHP is similar to connecting to a single MongoDB instance. The only difference is
that it can provide either a single replica set instance address or a list of replica set members; the connection library
will work out which server is the primary server and direct queries to that machine, even if the primary server is not
one of the members that you provide. For this reason it is often best to specify multiple members in your connection
 
 
Search WWH ::




Custom Search