First, master.
With the increase of the amount of data single MongoDB server has not met the status quo, so use the master-slave cluster
Master-slave replication is the most MongoDB most commonly used replication methods, his biggest feature is backup, for reading easy to expand, reduce server pressure!
MongoDB support for asynchronous replication in multiple machines in the end failover and implementation of redundancy, multiple machines at the same time only one is for write operations, which provides the MONGODB data consistency. The machine that plays the role of primary can distribute the read operation to the slave machine.
The master-slave cluster of MongoDB is divided into two kinds
Master-slave Replication (master-slave replication)
Replica Sets Replication (replica set)
Primary server support additions and deletions to this, from the server main support read.
Master-slave (master-slave copy)
You only need to add the-master parameter at the start of a service to indicate that the role of this server is primary, while the other service adds-slave and-source parameters to indicate that the role of this server is slave. To achieve synchronization,
This method is deprecated for the latest version of MongoDB.
Replica Sets Replication (replica set)
MongoDB developed the replica set in version 1.6, which mainly increased the failover and automatic repair of member nodes. The data is exactly the same across each db, with the most notable difference being that the replica set does not have a fixed master node. It is a master node of the whole cluster election. Change other nodes when they are not working.
Two kinds of startup methods, one is configuration file, the other is parameter