HAProxy ALOHA Documentation 10.5

NTP

You can synchronize HAProxy ALOHA to a Network Time Protocol (NTP) time server to:

  • enhance log accuracy, and

  • synchronize the date and time of all instances in a cluster.

The NTP service manages the Linux ntpdate daemon on the HAProxy ALOHA appliance.

See also

ntpdate(8) - Linux man page

Synchronize the date and time regularly

You can configure when and how HAProxy ALOHA synchronizes to an NTP server.

  1. In the Services tab, click ntp setup setup_icon.

    https://cdn.haproxy.com/documentation/aloha/10-5/assets/ntp_setup-2e6f7ac99e9ba51ae8ad7c6e48cd342e082265535b18171c9afa1a08949508c6.png

    The current configuration displays.

    service ntp
        force_sync
         check_interval 60
         no autostart
  2. Configure the ntp service.

    You can synchronize to an NTP server before starting the NTP daemon, bypass a firewall, or set how often HAProxy ALOHA synchronizes to a server.

    See the subsections below.

  3. Save the configuration, then restart restart_icon the ntp service.

Set the time before starting the NTP daemon

In some cases, you may want to set the clock before starting the ntpdate daemon.

  1. Use the force_sync and the sync_servers directives as follows.

    Replace the IP address in the example with the IP address of the NTP server you want to synchronize to.

    If the NTP server is located beyond a firewall that blocks incoming traffic to privileged ports, use an unprivileged port through the unpriv_port directive.

    service ntp
        force_sync
        sync_servers 129.6.15.28
        unpriv_port
  2. Once you have restarted the ntp service, check which actions took place in the console logs area in the Logs tab.

    Nov 22 17:22:51 ALOHA1 user.info  admin[2671]: ALOHA1# service 'ntp' 'restart'
    Nov 22 17:22:51 ALOHA1 user.notice  admin[2671]: # Stopping ntpd (pid 32527 according to /var/run/ntp.pid) ...
    Nov 22 17:22:51 ALOHA1 user.notice  admin[2671]:   Waiting.
    Nov 22 17:22:51 ALOHA1 user.notice  admin[2671]:   --> removing stale pid file ...
    Nov 22 17:22:51 ALOHA1 user.notice  admin[2671]:   ==> stop ntpd Done.
    Nov 22 17:22:51 ALOHA1 user.notice  admin[2671]: # Starting ntp ...
    Nov 22 17:22:51 ALOHA1 user.notice  admin[2671]:   Using ntpdate to sync with server(s) 129.6.15.28...
    Nov 22 17:22:57 ALOHA1 user.warn  admin[2671]:   /usr/sbin/ntpd -c /etc/ntp/ntp.conf -p /var/run/ntp.pid -k /etc/ntp/ntp.keys
    Nov 22 17:22:57 ALOHA1 user.notice  admin[2671]: 22 Nov 17:22:57 ntpdate[4419]: adjust time server 129.6.15.28 offset 0.000236 sec
    Nov 22 17:22:57 ALOHA1 user.notice  admin[2671]:   ==> start ntp Done.

Set how often HAProxy ALOHA synchronizes to an NTP server

By default, HAProxy ALOHA will synchronize to an NTP server every minute.

  1. Specify another interval in seconds through the check_interval directive.

    service ntp
        check_interval 120

    If set to 0 or lower, the default value is used.

  2. Once you have restarted the ntp service, check which actions took place in the console logs area in the Logs tab.

    Nov 22 16:20:02 ALOHA1 user.info  admin[2671]: ALOHA1# service 'ntp' 'restart'
    Nov 22 16:20:02 ALOHA1 user.notice  admin[2671]: # Stopping ntpd (pid 24501 according to /var/run/ntp.pid) ...
    Nov 22 16:20:02 ALOHA1 user.notice  admin[2671]:   Waiting.
    Nov 22 16:20:02 ALOHA1 user.notice  admin[2671]:   --> removing stale pid file ...
    Nov 22 16:20:02 ALOHA1 user.notice  admin[2671]:   ==> stop ntpd Done.
    Nov 22 16:20:02 ALOHA1 user.notice  admin[2671]: # Starting ntp ...
    Nov 22 16:20:02 ALOHA1 user.warn  admin[2671]:   /usr/sbin/ntpd -c /etc/ntp/ntp.conf -p /var/run/ntp.pid -k /etc/ntp/ntp.keys
    Nov 22 16:20:02 ALOHA1 user.notice  admin[2671]:   ==> start ntp Done.

Define other NTP servers used at runtime

By default, HAProxy ALOHA queries NTP servers from the France pool zone, https://www.ntppool.org/zone/fr, from the pool.ntp.org timeservers project.

You can also define other servers.

  1. In the Services tab, click the [advanced mode] link, then edit the ntp service.

    https://cdn.haproxy.com/documentation/aloha/10-5/assets/ntp_edit-18af6f5100df86b26dfeffa6bb9809e33ef1100a3851bf154a2ac11d56862534.png

    The content of the /etc/ntp/ntp.conf NTP configuration file displays.

  2. Edit the file, add server lines, save the configuration, then restart restart_icon the ntp service.

  3. Once you have restarted the ntp service, check which actions took place in the console logs area in the Logs tab.

    Nov 22 16:46:18 ALOHA1 user.info  admin[2671]: ALOHA1# service 'ntp' 'restart'
    Nov 22 16:46:18 ALOHA1 user.notice  admin[2671]: # Stopping ntpd (pid 29011 according to /var/run/ntp.pid) ...
    Nov 22 16:46:18 ALOHA1 user.notice  admin[2671]:   Waiting.
    Nov 22 16:46:18 ALOHA1 user.notice  admin[2671]:   --> removing stale pid file ...
    Nov 22 16:46:18 ALOHA1 user.notice  admin[2671]:   ==> stop ntpd Done.
    Nov 22 16:46:18 ALOHA1 user.notice  admin[2671]: # Starting ntp ...
    Nov 22 16:46:18 ALOHA1 user.warn  admin[2671]:   /usr/sbin/ntpd -c /etc/ntp/ntp.conf -p /var/run/ntp.pid -k /etc/ntp/ntp.keys
    Nov 22 16:46:18 ALOHA1 user.notice  admin[2671]:   ==> start ntp Done.

Set the time and date once

You can manually set the local time and date of your HAProxy ALOHA appliance by synchronizing once with an NTP server or by entering a value.

  1. In the Date area on the Setup tab:

    • enter the IP address of an NTP server, or,

    • manually enter a time and date.

    https://cdn.haproxy.com/documentation/aloha/10-5/assets/ntp_update-a32e0873281bf288c359849638906837df298947dd11ccc3d7362f9e30405985.png
  2. Click Update to set the system clock.

  3. Check the updated system time in the Setup tab.

    https://cdn.haproxy.com/documentation/aloha/10-5/assets/ntp_system-69f65e9676d68082283ee80ba27b33ae8d5ad6233d082ea44953d8dc400f246c.png

    You can also check the console logs area in the Logs tab.

    Nov 19 15:09:11 ALOHA1 user.notice  admin[2671]: 19 Nov 15:09:11 ntpdate[22876]: adjust time server 129.6.15.28 offset -0.000143 sec
    Nov 19 15:09:11 ALOHA1 user.info  admin[2671]: ALOHA1# service 'system' 'date_to_hw'
    Nov 19 15:09:12 ALOHA1 user.notice  admin[2671]: Saving system time to hardware clock (UTC)... Done.

Next up

VLAN
HAProxyConf 2022 - Call for papers