|
启动后,需要通过sh.addShard()命令添加分片服务器:
- sh.addShard('127.0.0.1:27020')
- sh.addShard('127.0.0.1:27021')
- sh.addShard('127.0.0.1:27022')
- sh.addShard('127.0.0.1:27023')
配置完成后,可以通过sh.status()命令,查看分片情况:
- mongos> sh.status()
- --- Sharding Status ---
- sharding version: {
- "_id" : 1,
- "minCompatibleVersion" : 5,
- "currentVersion" : 6,
- "clusterId" : ObjectId("5d8ddd1d94796dc650e29f67")
- }
- shards:
- { "_id" : "shard0000", "host" : "127.0.0.1:27020", "state" : 1 }
- { "_id" : "shard0001", "host" : "127.0.0.1:27021", "state" : 1 }
- { "_id" : "shard0002", "host" : "127.0.0.1:27022", "state" : 1 }
- { "_id" : "shard0003", "host" : "127.0.0.1:27023", "state" : 1 }
- active mongoses:
- "4.2.0" : 1
- autosplit:
- Currently enabled: yes
- balancer:
- Currently enabled: yes
- Currently running: no
- Failed balancer rounds in last 5 attempts: 0
- Migration Results for the last 24 hours:
- No recent migrations
- databases:
- { "_id" : "config", "primary" : "config", "partitioned" : true }
- config.system.sessions
- shard key: { "_id" : 1 }
- unique: false
- balancing: true
- chunks:
- shard0000 1
- { "_id" : { "$minKey" : 1 } } -->> { "_id" : { "$max
(编辑:哈尔滨站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|