What do I watch, which settings matter, and where do I look first?
The signals I watch, the logs I read, the parameters that decide most outcomes, and the commands that show the truth on a live deployment.
The signals I put on a dashboard and alert on, and why each one matters.
Example dashboard: the thresholds are starting points I would tune per system, and the colors are made up for the picture.
| Signal | Why I watch it | Where it comes from |
|---|---|---|
| Latency and errors | What users feel. | Slow query log, $currentOp, the driver |
| Connections | Each costs memory; at the limit, new ones are refused. | serverStatus().connections |
| WiredTiger cache | Near 95% full or 20% dirty, app threads help evict and latency jumps. | serverStatus().wiredTiger.cache |
| Replication and elections | A failover loses w: 1 writes that had not replicated. | rs.status(), rs.printSecondaryReplicationInfo() |
| Oplog window | Shorter than a maintenance window means a full resync. | db.getReplicationInfo() |
| Disk and backups | A backup counts only once a restore has been tested. | The OS, your backup tool |
Run the checks on your own deployment with the health check.
Same idea as PostgreSQL: exact names, one job per log, one check per incident. The rule is written once on the PostgreSQL page. This table adds the operational logs a DBA reads first: server, error, slow.
| Log | Exact file name | Where it sits (on-prem) | What it does | What to check in it |
|---|---|---|---|---|
| MongoDB Journal | journal/WiredTigerLog.0000000123 | journal/ inside the dbPath | WiredTiger's write-ahead log. It covers the gap between checkpoints (about 60 s). j:true waits for this. | Check that the files exist and turn over. Check journal commit latency in db.serverStatus().wiredTiger.log. |
| MongoDB Oplog | local.oplog.rs | A capped collection in the local database. Not a file | Ordered record of every write on the primary. Secondaries tail it. Its size divided by write rate is the catch-up window. | rs.printReplicationInfo(). "log length start to end" is the window in hours. Compare it to your longest maintenance. |
| MongoDB mongod log | mongod.log | /var/log/mongodb/mongod.log | The server's diary. Elections. Slow operations (over the profiler threshold). Connection events. | Election events and slow-operation lines around the incident start. Stepdown and stepup pairs mark every failover. |
Same three outage rules as PostgreSQL: Safe live lever, Planned change, Do not touch. What each one means is written once on the PostgreSQL page.
| Parameter | What it does | During an outage |
|---|---|---|
| storage.wiredTiger.engineConfig.cacheSizeGB | Size of the WiredTiger cache. Default is about 50% of (RAM minus 1 GB), or 256 MB if that is larger. | Planned change. It is set in the config file. Applying it means a rolling restart of the set. Mid-incident, the evidence comes first: serverStatus().wiredTiger.cache. The live fixes are killing the cache-churning operation or the pinned snapshot, not the cache size. |
| oplogSizeMB / replSetResizeOplog | Size of the capped oplog collection. Window equals size divided by write rate. | Safe live lever (dynamic since 3.6; minRetentionHours since 4.4). Enlarge the oplog on every member, one at a time, before planned maintenance so the window exceeds the downtime. replSetResizeOplog changes only the member it runs on. It cannot recover entries that already rolled off. |
| writeConcern / readConcern | Per-operation guarantees set by the application. How many members must acknowledge a write (w). Whether it must be journaled (j). Which writes a read may see. | Application change, not a server knob. Do not weaken w:'majority' mid-outage to make writes "fast again", unless rollback-on-election is explicitly acceptable. Shifting readPreference to secondaries sheds primary load but serves staler data. That is a routing decision, not a repair. |
Same rule as PostgreSQL: every mechanism above is observable on a running server in under two minutes. The full version is on the PostgreSQL page.
Run it locally: docker-compose-mongo.yml starts MongoDB 8.0 on port 27017 with a shop database. docker compose -f docker-compose-mongo.yml up -d, then run the commands below against it.
// where is everything? db.adminCommand({getCmdLineOpts: 1}) // → parsed.storage.dbPath db.users.stats().wiredTiger.uri // → "table:collection-2-4471…" $ ls /var/lib/mongo/journal // → WiredTigerLog.0000000123 // the oplog: size, window, latest entry rs.printReplicationInfo() rs.status() // members + optime lag // cache pressure db.serverStatus().wiredTiger.cache
How do databases actually work? From one row on disk to transactions: the words you need, PostgreSQL, MySQL and MongoDB from the files up, then Redis, Cassandra and vector search, side by side, and the query and concurrency traps.