MongoDB Sharding - 为什么我的数据不会在所有分片上分发?

时间:2016-04-22 10:04:33

标签: mongodb sharding

我创建了一个包含3个分片的MongoDB群集,每个分片包含3个mongod-processes。我的群集还包含3个mongos和3个config servers

在连接字符串中,我放了3 mongos

mongodb://user:pass@mongos1:27017,mongos2:27017,mongos3:27017/mydatabase

在图片中,您可以看到dbShard_2有1.19GB的数据,而其他几乎是空的,只有4KB。但是在图表上,您可以看到所有分片上都有读/写操作。一切都很好还是我做了一些错误的配置?我要担心吗?

我离开了Cloud Manager为我做了整个配置,我没有自己手动设置这些。

您可以在此检查我的分片状态

mongos> db.printShardingStatus();
--- Sharding Status ---
  sharding version: {
        "_id" : 1,
        "minCompatibleVersion" : 5,
        "currentVersion" : 6,
        "clusterId" : ObjectId("XXXXX")
}
  shards:
        {  "_id" : "dbShard_0",  "host" : "dbShard_0/dbnode-0.x-app.com:27000,dbnode-1.x-app.com:27000,dbnode-2.x-app.com:27000" }
        {  "_id" : "dbShard_1",  "host" : "dbShard_1/dbnode-0.x-app.com:27001,dbnode-2.x-app.com:27001,dbnode-2.x-app.com:27002" }
        {  "_id" : "dbShard_2",  "host" : "dbShard_2/dbnode-0.x-app.com:27002,dbnode-1.x-app.com:27001,dbnode-2.x-app.com:27003" }
  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" : "admin",  "partitioned" : false,  "primary" : "config" }
        {  "_id" : "mydatabase-staging",  "partitioned" : false,  "primary" : "dbShard_2" }
        {  "_id" : "mydatabase",  "partitioned" : false,  "primary" : "dbShard_2" }
        {  "_id" : "test",  "partitioned" : false,  "primary" : "dbShard_0" }

Cluster

0 个答案:

没有答案