MongoDB 分片、主从配置 及 原理
有三台机器:A、B、C(三个主从复制,两个分片)
1、分别在 A、B、C 三台机器上启动 两个分片、主从服务,命令如下:
db.runCommand({ enablesharding:"test" })db.runCommand({ shardcollection: "test.users", key: { _id:1 }})