分片配置
指定数据库, 开启分片, 指定 Collection 的分片策略
sh.enableSharding("test") sh.shardCollection("test.col",{id:"hashed"}) ### 比如再添加一个 use mongo-study sh.enableSharding("mongo-study") sh.shardCollection("mongo-study.test-collection",{id:"hashed"})
指定数据库, 开启分片, 指定 Collection 的分片策略
sh.enableSharding("test") sh.shardCollection("test.col",{id:"hashed"}) ### 比如再添加一个 use mongo-study sh.enableSharding("mongo-study") sh.shardCollection("mongo-study.test-collection",{id:"hashed"})