Chapter 15. Syncronizing Clocks in the Cluster

To use the xntpd(8) extended network time protocol, install xntpd(8) on each node in the cluster and configure the daemon to synchronize with a master server.

Do the following on each node in the cluster:

  1. Install the xntpd(8) package from the base OS.

    For example, using the Red Hat CD, do the following:

    # /bin/mount /dev/cdrom /mnt/cdrom
    # cd /mnt/cdrom/RedHat/RPMS# /bin/rpm -i xntp*

  2. Edit the /etc/ntp.conf file and add a driftfile and a list of the hostnames to use as xntp servers. (The driftfile contains the difference between the clocks and is required by xntpd.) For example, if external master servers are used, the /etc/ntp.conf file could contain the following:

    driftfile /etc/ntp.drift
    server mum.sgi.com
    server lilly.sgi.com
    server carnation.sgi.com

  3. Ensure that the nodes have the correct timezone.

    For example, to use the tzselect(8) command to set the timezone to CST, do the following on each node in the cluster:

    # tzselect
    Please identify a location so that time zone rules can be set correctly.
    Please select a continent or ocean.
     1) Africa
     2) Americas
     3) Antarctica
     4) Arctic Ocean
     5) Asia
     6) Atlantic Ocean
     7) Australia
     8) Europe
     9) Indian Ocean
    10) Pacific Ocean
    11) none - I want to specify the time zone using the Posix TZ format.
    2
    Please select a country.
     1) Anguilla              18) Ecuador               35) Paraguay
     2) Antigua & Barbuda     19) El Salvador           36) Peru
     3) Argentina             20) French Guiana         37) Puerto Rico
     4) Aruba                 21) Greenland             38) St Kitts & Nevis
     5) Bahamas               22) Grenada               39) St Lucia
     6) Barbados              23) Guadeloupe            40) St Pierre & Miquelon
     7) Belize                24) Guatemala             41) St Vincent
     8) Bolivia               25) Guyana                42) Suriname
     9) Brazil                26) Haiti                 43) Trinidad & Tobago
    10) Canada                27) Honduras              44) Turks & Caicos Is
    11) Cayman Islands        28) Jamaica               45) United States
    12) Chile                 29) Martinique            46) Uruguay
    13) Colombia              30) Mexico                47) Venezuela
    14) Costa Rica            31) Montserrat            48) Virgin Islands (UK)
    15) Cuba                  32) Netherlands Antilles  49) Virgin Islands (US)
    16) Dominica              33) Nicaragua
    17) Dominican Republic    34) Panama
    45
    Please select one of the following time zone regions.
     1) Eastern Time
     2) Eastern Time - Michigan - most locations
     3) Eastern Time - Louisville, Kentucky
     4) Eastern Standard Time - Indiana - most locations
     5) Eastern Standard Time - Indiana - Crawford County
     6) Eastern Standard Time - Indiana - Starke County
     7) Eastern Standard Time - Indiana - Switzerland County
     8) Central Time
     9) Central Time - Michigan - Wisconsin border
    10) Mountain Time
    11) Mountain Time - south Idaho & east Oregon
    12) Mountain Time - Navajo
    13) Mountain Standard Time - Arizona
    14) Pacific Time
    15) Alaska Time
    16) Alaska Time - Alaska panhandle
    17) Alaska Time - Alaska panhandle neck
    18) Alaska Time - west Alaska
    19) Aleutian Islands
    20) Hawaii
    8
    
    The following information has been given:
    
            United States
            Central Time
    
    Therefore TZ='America/Chicago' will be used.
    Local time is now:      Mon Dec  6 22:35:28 CST 1999.
    Universal Time is now:  Tue Dec  7 04:35:28 UTC 1999.
    Is the above information OK?
    1) Yes
    2) No
    1
    America/Chicago

    Or, you could reset the /etc/localtime symbolic link as follows:

    # rm /etc/localtime
    # ln -s ../usr/share/zoneinfo/us/central /etc/localtime

  4. Ensure that the node system clocks and hardware clocks are not too far off from the correct time.


    Note: The xntpd daemon cannot synchronize the clocks if the difference between the master and client is too great.


    1. Set the correct time on the node's system clock by using the date(1) command. For example, to set the time to 10:36 AM on Tuesday December 7, 1999, enter the following:

      # date 1207103699
      Tue Dec  7 10:36:00 CST 1999

    2. Synchronize the hardware clock with the system clock by using the setclock(8) command. For example:

      # setclock

    3. Verify that the timestamps for the system clock and hardware clock are close to the same by entering the date(1) and clock(1) commands. For example:

      # date
      Tue Dec  7 10:36:05 CST 1999
      # clock
      Tue Dec  7 10:36:09 1999  -0.969269 seconds

  5. Verify that the driftfile exists by using the touch(1) command. For example:

    # touch /etc/ntp.drift

  6. Start the xntpd(8) daemon:

    • To start xntpd now, enter the following:

      # /etc/rc.d/init.d/xntpd start

    • To start xntpd at boot time, enter the following:

      # /sbin/chkconfig xntpd on
      
      

To verify the status of the xntpd(8) daemon, look at the /var/log/messages file. For example:

# tail -f /var/log/messages | grep xntpd
Dec  7 10:36:25 green xntpd[9036]: xntpd 3-5.93e Wed Apr 14 20:23:29
EDT 1999 (1)
Dec  7 10:36:25 green xntpd[9036]: tickadj = 5, tick = 10000,
tvu_maxslew = 495, est. hz = 100
Dec  7 10:36:26 green xntpd[9036]: precision = 13 usec
Dec  7 10:36:26 green xntpd[9036]: read drift of 0 from /etc/ntp.drift
Dec  7 10:41:22 green xntpd[9036]: synchronized to 10.162.8.103,
stratum=1
Dec  7 10:41:32 green xntpd[9036]: time reset (step) 9.206565 s
Dec  7 10:41:32 green xntpd[9036]: synchronisation lost
Dec  7 10:46:23 green xntpd[9036]: synchronized to 10.162.1.126,
stratum=2
Dec  7 10:46:52 green xntpd[9036]: synchronized to 10.162.8.103,
stratum=1

To synchronize to a clock other than the head node, see the xntp documentation in the /usr/doc directory.