DBAtlas · Database operations atlas

Clock skew / NTP problem

Symptom

Clock differences between cluster nodes; replication/election inconsistencies, 'certificate not yet valid', time jumps in logs.

1. Recognize the symptom

Clock skew is insidious: Mongo/Redis Sentinel election flapping, TLS 'not yet valid/expired' errors, Kerberos errors, timestamps going backwards in logs. In distributed systems, it is the root of most 'unexplainable' oddities.

2. Measure the difference

On each node, compare the time source and offset: timedatectl, chronyc tracking (or ntpq -p), and date -u across nodes. How many ms/s apart are they?

3. Fix NTP/chrony

Is chronyd/ntpd running, can it reach its time sources, is it synchronized? Start the service and fix the source; for large offsets, step carefully (a sudden jump can trigger some DBs).

4. Verify the affected component

After the clock is fixed, check: is the MongoDB replica set election stable, is Redis Sentinel/Cluster healthy, do TLS handshakes succeed, have the replication lag metrics recovered?

5. Permanent

Make NTP mandatory on all nodes and monitor the offset (alert: >100ms). On virtual machines, settle the host-guest time sync setting; preferably use a single, reliable time source hierarchy.

Open in DBAtlas →