Update MongoDB_分片.md

This commit is contained in:
heibaiying 2019-12-30 17:04:46 +08:00 committed by GitHub
parent e826130a7a
commit dda40ddaff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -290,7 +290,7 @@ db.runCommand({ addshard : "rs1/hadoop001:37018,hadoop002:37018,hadoop003:37018"
#### 1. 开启分片功能
连接到 mongos ,对 testdb 数据库开启分片功能,同时设置集合 users 的分片键为用户 id后面的`1`表示范围分片,如果想要采用哈希分片,则对应的写法为: `{uid:"hashed"}`
连接到 mongos ,对 testdb 数据库开启分片功能,同时设置集合 users 的分片键为用户 id后面的 `1` 表示范围分片,如果想要采用哈希分片,则对应的写法为: `{uid:"hashed"}`
```shell
db.runCommand({ enablesharding : "testdb" })