1

I am facing an issue in the shard distribution.

MongoDB Version: 3.0.15

I have a collection that is sharded. I have two shards.

Output of db.getCollection('event').stats()

{
 "sharded" : true,
 "capped" : false,
 "ns" : "coll.event",
 "count" : 386631514,
  size" : NumberLong(4178195857267),
 "storageSize" : 293516279808.0,
 "totalIndexSize" : 391203631104.0,
 "shards" : {
    **"shard0000" :** {
    "ns" : "coll.event",
    "count" : 182463940,
    "size" : NumberLong(2187685928765),
    "avgObjSize" : 11989,
    "storageSize" : 148825059328.0,
    "capped" : false,            
    },
**"shard0001"** : {
    "ns" : "coll.event",
    "count" : 204167574,
    "size" : NumberLong(1990509928502),
    "avgObjSize" : 9749,
    "storageSize" : 144691220480.0,
    "capped" : false,
    }
},
"ok" : 1.0
}

Output of Shard Distribution

db.getCollection('event').getShardDistribution()

Shard shard0000 at localhost:27010

Even though there are two shards, the shard distribution shows only one. Now only one of the sharded folder is getting full.

Why is it so? What do I have to do to make the shard distribution common?

0

As per MongoDB documentation here which prints the data distribution statistics for a sharded collection. You must call the getShardDistribution() method on a sharded collection, as in the following example:

db.myShardedCollection.getShardDistribution()

In the following example, the collection has two shards. The output displays both the individual shard distribution information as well the total shard distribution:

Shard <shard-a> at <host-a>
 data : <size-a> docs : <count-a> chunks : <number of chunks-a>
 estimated data per chunk : <size-a>/<number of chunks-a>
 estimated docs per chunk : <count-a>/<number of chunks-a>

Shard <shard-b> at <host-b>
 data : <size-b> docs : <count-b> chunks : <number of chunks-b>
 estimated data per chunk : <size-b>/<number of chunks-b>
 estimated docs per chunk : <count-b>/<number of chunks-b>

Totals
 data : <stats.size> docs : <stats.count> chunks : <calc total chunks>
 Shard <shard-a> contains  <estDataPercent-a>% data, <estDocPercent-a>% docs in cluster, avg obj size on shard : stats.shards[ <shard-a> ].avgObjSize
 Shard <shard-b> contains  <estDataPercent-b>% data, <estDocPercent-b>% docs in cluster, avg obj size on shard : stats.shards[ <shard-b> ].avgObjSize

For your further ref here, here

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.