Thursday, January 8, 2009

Time Synchronization across the lab

All servers and workstations within the lab need to keep time in sync. This is needed to correctly detect changes for automated build process, or to properly manage change_date columns in a database, or for other forms of Optimistic concurrency control.

Network_Time_Protocol (NTP) is used to synchronize time on all lab systems. Our local ntp server is 192.168.8.5, setup to synchronize with time.chu.nrc.ca. All the other machines are set as ntp clients using 192.168.8.5 as their time source.

How to setup the ntp client?
For Linux/Unix machines, make sure port 123/UDP is open in the firewall.

Procedure for Windows: Open Registry editor (regedit) and modify following keys:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters]
"NtpServer"="192.168.8.5"
"Type"="NTP"
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient]
"SpecialPollInterval"="900"

This will set correct ntp server and change the poll interval from decimal value 604800 = 1 week to 900 = 15 min. Reboot the machine, or restart the Windows Time service (e.g. from command line net stop w32time && net start w32time).

The VMWare ESX servers (host machines) are synchronized to 192.168.8.5 as well. All virtual machines get their time from the ESX Server on bootup, migration or reverting snapshots. (You need to hack the vmx files if you want to disable this feature.) The VMTOOLS allows you to also set time synchronization with the ESX host (this is off by default). You can change this in the Settings of the Virtual machine OPTIONS-VMWARE Tools- check Synchronize guest time with host.
Unfortunately, we didn't have success with either method of VMWare synchronization. Switching on time sync in VMWare Tools didn't help. We tried to shutdown and power on the guest, but there was the same difference against the host time (~2 min) as before (with VMTools sync on). So, we rely only on NTP synchronization.

No comments: