First, copy set
- Replica the schema of the set
- Deployment of Replica Set
- Master-Slave operation Log
- Inside the Local Database: Db.oplog.rs.find ()
- Basic information for the log: Db.printreplicationinfo ()
- View slave's presentation status: Db.printslavereplicationinfo ()
- Master/Slave configuration information: Db.system.replset.find ()
- Managing replica Set
- Master-Slave switching
1 Frozen instances do not participate in primary elections: Rs.freeze (30)
2 downgrade: Rs.stepdown (30)
- Read/write separation
1 Make slave readable: db.getMongo.setSlaveOk ()
- Failover: Kill Process
- Add or Subtract nodes
1 Add node: Rs.add ("localhost:27017")
2 Reduction node: Rs.remove ("localhost:27017")
Second, The Shard
- sharding Introduction
- Features of Sharding
1 extensibility
2 increasing the high availability of databases
3 Pressure separation
- Architecture of the Sharding
1 sharding Server: Each database server that stores shards.
2 Configuration Server: Node configuration information, chunk Shard key range, distribution, configuration information.
3 Routing Process: forwarding
- The construction of sharding cluster
- Maintenance of Sharding
- List all sharding Server:db.runCommand ({listshards:1})
- View Sharding's information: Printshardingstatus ()
- Determine if it is Sharding:db.runCommand ({isdbgrid:1})
- Sharding:db.runCommand the table ({shardcollection: "Ken.ken", Key:{_id:1}})
- New Sharding Server:db.runCommand ({addshard:locahost:27020})
- Remove Sharding Server:db.runCommand ({remove:localhost:27020})
Third, Replica sets+sharding architecture
- Combine replication sets and sharding machines
MongoDB Architecture Chapter