Setting server time with ntp
Tradebit today runs on a self-made Linux “cluster” with 12 nodes. Some serve MySQL databases, some do web servers and others are for storage. For us it is very important, that all these servers have the same server time. Especially for the sales stats and other logging functionality.
Over time, if you do not keep your time in sync on all boxes, the time of the servers starts to differ in minutes and the longer you let it run… it can become hours.
On Linux there is a nice tool, which should be already installed on your servers:
ntpdate
which fetches the actual date and time from servers, which are synced by radio or satellite controlled clocks. To set your hardware clock with this command, you can log in to your machine and start:
/usr/sbin/ntpdate ntp5.tamu.edu
where “ntp5.tamu.edu” is a time server in Houston, TX. You should pick your own time server close to you… Google for “ntp time server list” to get actual lists.
The command above does not set the hardware clock yet. Expand the command with the second command “hwclock” and write output to /dev/null in a script:
/usr/sbin/ntpdate ntp5.tamu.edu 2>/dev/null >/dev/null && hwclock -w 2>/dev/null
fetches the date and sets the hardware clock on linux to the actual time.
The same tool is also available for Windows!


