Script #90
mongodb
Storageread-onlyMin Version: 4.4MongoDB Sharded Collection Data Distribution and Balancer Status
Shows data and document distribution per shard and the balancer state. Finds unbalanced shards and hot shard issues.
#sharding#chunks#balancer
mongodb · javascript
sh.status(); // genel durum
sh.isBalancerRunning();
sh.getBalancerState();
// Belirli koleksiyon için shard dağılımı:
db.getSiblingDB("mydb").orders.getShardDistribution();Operational Notes & Remediation Guidance
Verify that the shard balancer is running and chunks are evenly distributed across all shards.
Production Safety & Execution Standards
- This script is designed for read-only diagnostics; it does not alter schema or modify data directly.
- Prior to executing on production systems under high load, verify the target database version (Min. Version: 4.4).
- Exercise caution with mutating actions (e.g., terminating sessions or dropping indexes) referenced in the notes section.
Other MONGODB Diagnostic Scripts
View All (100)#81Performance
Find Long-Running Operations in MongoDB (currentOp)
Lists active operations running longer than 5 seconds with plan summary and lock-wait info. Helps pick the operation to kill during a slowdown.
View Script
#82Storage
MongoDB Collection and Index Sizes
Ranks collections by document count, data, storage and index size. Used for capacity planning and spotting bloated indexes.
View Script
#83Performance
Find Unused Indexes in MongoDB ($indexStats)
Lists never-used indexes per collection. Offers cleanup candidates to cut write cost and memory use.
View Script
#84Replication
MongoDB Replica Set Lag and Oplog Window
Shows member state, lag behind the primary and the oplog window. Monitors replication health and resync risk.
View Script