I have 12 servers in which there are 4 replicas.
The architecture of the mongo servers and the disk spaces are present like:

1st replica
s1-rep1 - 287GB
s1-rep2 - 0GB
s1-rep3 - 0GB
2nd replica
s2-rep1 - 331GB
s2-rep2 - 332GB
s2-rep3 - 330GB
3rd replica
s3-rep1 - 564GB
s3-rep2 - 567GB
s3-rep3 - 564GB
4th replica
s4-rep1 - 600GB
s4-rep2 - 600GB
s4-rep3 - 555GB

1) Why the disk spaces are different for different servers since we are doing sharding(hashed key) for every collection which we are loading into it.
2) How to recover the disk space, that there should be equal disk space should be available on all the servers.
3) My master servers are present at the servers s1-rep2 and s3-rep1.
4) My config servers are present at the servers s1-rep1, s2-rep1 and s2-rep3.
How to debug these type of issues regarding disk spaces?. The collections should not get effected as we all use these servers for prod.

1 Answer 1

  1. Sharding distributes chunks evenly, all chunks are not filled evenly and some of documents (in the chunks) are bigger than other.

  2. Do initial sync on secondaries, stop secondary (mongod), remove all files from dbPath, start secondary (mongod) and let it do initial sync. Repeat that other secondary nodes, one by one. Step down primary and do same initial sync.

3./4. DON'T mix data replica sets and config replica sets on at same nodes. Keep those separated. One mongod process per physical/virtual machine.

  • I couldn't figure out the reason behind the uneven disk spaces among shards. What might be the reason behind this. When i queried for db.printShardingStatus for a collection, it shows like: ` db.collection shard key: { "_id" : "hashed" } unique: false balancing: true chunks: shard1_repl 1 shard2_repl 1 shard3_repl 1 shard4_repl 1 ` Aug 29, 2017 at 14:30

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