[ntp:questions] ntpd and database servers

unruh unruh at wormhole.physics.ubc.ca
Fri Jan 15 00:11:30 UTC 2010

On 2010-01-14, Richard B. Gilbert <rgilbert88 at comcast.net> wrote:
> nodata wrote:
>> Hello,
>> I have had two problems recently that I was unable to solve properly, so 
>> I am turning to the list to help.
>> I had two database servers where the clock was wrong, by a couple of 
>> hours (too fast). On the first server, ntpd was running but refusing to 
>> sync the clock because of the time difference. On the second server, 
>> ntpd was not running.
>> These database servers can be stopped quarterly. For data integrity 
>> purposes the clock must not jump backwards. It's more important that the 
>> database server is up and running that if the timestamps are off by a 
>> couple of hours.
>> Which brings me to my problem: once this problem came to our attention, 
>> we wanted to fix it, slowing the system clock until time caught up. It 
>> wouldn't matter if this took a few weeks.
>> What is the correct way of solving this? Both on the first server with 
>> ntpd running but out of sync and refusing to update, and on the second 
>> server where ntpd was not running (and I want to avoid a sync on start, 
>> and then avoid the same problem as the first server).
>> Hope someone can offer their advice for this situation and question.
>> Note: (sorry to be rude) I'm not looking for an answer which is "plan 
>> downtime", or "except the risk of a clock jumping backwards". Thanks.
> NTP can, at most, correct your clock at the rate of 43 seconds per day!
> It WILL take quite a while to correct a two hour error.  If you can't 
> schedule down time to get your clocks straightened out you will have to 
> live with it for a while.  How long it will take is left as an exercise 
> for the student! ;-)

Note, chrony, another implimentation of ntp, can adjust the clock much
much faster than that. It uses both the tickadj and the rate to set the
clock and slews the clock at up the max rate that adjtimes allows the
clock to be slewed. And it has no 1000 sec, or 1/8 sec step limits that
ntp has. 

Note it only runs on Linux or BSD

> Once you have them set to the correct time, NTPD should be able to 
> maintain the correct time, which it will do by slightly adjusting the 
> "size" of the ticks.  Assuming that your clock is not in error by more 
> than about 100 parts per million, NTPD will keep your clock in synch 

The limit is 500PPM. (chrony's limit is essentially 100000PPM)

> with UTC (formerly known as GMT).  Most operating systems will allow you 
> to instruct your computer to display the time in your local timezone if 
> you wish.

More information about the questions mailing list