Databases Reference
In-Depth Information
... "_id" : 1,
... "host" : "morton:10001"
... },
... {
... "_id" : 2,
... "host" : "morton:10002"
... }
... ]}})
{
"info" : "Config now saved locally. Should come online in about a minute.",
"ok" : true
}
The initialization document is a bit complicated, but going through it key by key should
make sense:
"_id" : "blort"
The name of this set.
"members" : [...]
A list of servers in the set. You can add more later. Each server document has (at
least) two keys:
"_id" : N
Each server needs a unique ID.
"host" : hostname
This is the key that actually specifies the host.
Now you should see some log messages about which server is being elected primary.
If we connect to the other server and do a find on the local.system.replset namespace,
you can see that the configuration has been propagated to the other server in the set.
At the time of this writing, replica sets are still under development and
have not yet been released in a production version of MongoDB. As
such, the information here is subject to change. For the most up-to-date
documentation on replica sets, see the MongoDB wiki .
Nodes in a Replica Set
At any point in time, one node in the cluster is primary , and the rest are secondary . The
primary node is essentially the master, the difference being that which node is desig-
nated as primary can vary over time.
 
Search WWH ::




Custom Search