dataiotech Labs
Scripts Library/mongodb/#100
Script #100
mongodb
Monitoringread-onlyMin Version: 4.4

MongoDB Chunk Migrations and Balancer Errors

Reads recent chunk move events and errors from the config database. Detects balancer problems and unnecessary migrations.

#balancer#chunk-migration#config
mongodb · javascript
db.getSiblingDB("config").changelog.find(
  { what: /moveChunk/ },
  { time: 1, what: 1, ns: 1, details: 1 }
).sort({ time: -1 }).limit(20);
Operational Notes & Remediation Guidance

Verify in a staging environment prior to running in production. This is a read-only diagnostic query; it does not acquire exclusive locks.

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.

Engineering Triad: Related Runbooks & Incident Response

Which production incidents and emergency drills execute this script as a diagnosis step?

Runbook Library (63)
Proactive Maintenance & Health Check: This script is not tied to an active incident alert; it is intended for scheduled maintenance, capacity planning, and routine DBA audits.