El protocolo Network Time Protocol (NTP) se utiliza para sincronizar la hora y fecha de todos los nodos dentro del clúster. La configuración de NTP es crítica para cualquier clúster de Hadoop. Cualquier falta de sincronismo en los servidores puede desembocar en serios problemas con HBase y otros servicios.
En nuestro caso vamos a instalar chrony en todos los nodos y a configurarlo para que utilice el servidor NTP del centro.
1 2 3 4 5 6 7 8 9 10 11 12 |
# apt install chrony Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libevent-core-2.1-7 libevent-pthreads -2.1-7 libopts25 sntp Use 'apt autoremove' to remove them. The following packages will be REMOVED: systemd-timesyncd The following NEW packages will be installed: chrony ℗ upgraded, 1 newly installed, 1 to remove and 50 not upgraded. Need to get 220 kB of archives. After this operation, 284 kB of additional disk space will be used. |
El archivo de configuración de chrony, /etc/chrony/chrony.conf, queda:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# This will use (up to): # 4 sources from ntp.ubuntu.com which some are ipv6 enabled # - 2 sources from 2.ubuntu.pool.ntp.org which is ipv6 enabled as well #- 1 source from [01].ubuntu.pool.ntp.org each (ipv4 only atm) #This means by default, up to 6 dual-stack and up to 2 additional IPv4-only sources will be used. #At the same time it retains some protection against one of the entries being # down (compare to just using one of the lines). See (LP: #1754358) for the discussion. #About using servers from the NTP Pool Project in general see (LP: #104525). # Approved by Ubuntu Technical Board on 2011-02-08. # See http://www.pool.ntp.org/join.html for more information. #pool ntp.ubuntu.comiburst maxsources 4 #pool 0.ubuntu.pool.ntp.org iburst maxsources 1 #pool 1.ubuntu.pool.ntp.org iburst maxsources 1 #pool 2.ubuntu.pool.ntp.org iburst maxsources 2 server 10.22.87.1 # This directive specify the location of the file containing ID/key pairs for # NTP authentication. keyfile /etc/chrony/chrony.keys # This directive specify the file into which chronyd will store the rate # information. driftfile /var/lib/chrony/chrony.drift #Uncomment the following line to turn logging on. #log tracking measurements statistics |
1 2 3 4 5 6 7 8 |
# timedatectl set-ntp true # timedatectl Local time: Tue 2023-12-19 12:41:17 UTC Universal time: Tue 2023-12-19 12:41:17 UTC RTC time: Tue 2023-12-19 12:41:17 Time zone: Etc/UTC (UTC, +0000) System clock synchronized: yes NTP service: active RTC in local TZ: no |