Specifically getting,
Hi,
If i change a system date to lets say 2/3 months ahead,>and then set it back to current date.
From the error message:
New cluster time, 1627201609, is too far from this node's wall clock time, 1564043336.
it’s not set to 2/3 months ahead. Rather, it’s set to 2 years ahead:
> new Date(1564043336 * 1000)
ISODate("2019-07-25T08:28:56Z")
> new Date(1627201609 * 1000)
ISODate("2021-07-25T08:26:49Z")
To determine the approximate order of operation in a distributed system, MongoDB uses a Lamport clock, with a defined maximum tolerance of forward/backward movement of 1 year (as per MongoDB 4.0.11). Lamport clocks have a property of always-increasing timestamp. Realistically, any part of your cluster should not have a time difference of more than 1 year. If you do, then this error will appear.
If you’re faced with this situation, you have two possibilities:
I’m guessing that you’re testing failure modes, but since most Linux distros have ntp or similar service by default, your clock should not differ by more than 1 year.
Best regards,
Kevin