A) 시간 정보를 참조할 서버 정보 등록
root 계정으로 vi /etc/chrony.conf 하여 설정 수정
server [동기화 서버의 IP] iburst
[root@ol9 ~]# cat /etc/chrony.conf # Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). #server 0.rhel.pool.ntp.org iburst #server 1.rhel.pool.ntp.org iburst #server 2.rhel.pool.ntp.org iburst #server 3.rhel.pool.ntp.org iburst server 192.168.0.70 iburst ## ==> 시간 동기화 서버 정보 추가 # Record the rate at which the system clock gains/losses time. driftfile /var/lib/chrony/drift # Allow the system clock to be stepped in the first three updates # if its offset is larger than 1 second. makestep 1.0 3 # Enable kernel synchronization of the real-time clock (RTC). rtcsync # Enable hardware timestamping on all interfaces that support it. #hwtimestamp * # Increase the minimum number of selectable sources required to adjust # the system clock. #minsources 2 # Allow NTP client access from local network. #allow 192.168.0.0/16 # Serve time even if not synchronized to a time source. #local stratum 10 # Specify file containing keys for NTP authentication. #keyfile /etc/chrony.keys # Specify directory for log files. logdir /var/log/chrony # Select which information is logged. #log measurements statistics tracking
{}
RAC나 Data Guard와 같이 클러스터 또는 HA 환경을 구성하기 위해서는 서버 간의 시간 동기화 설정이 필수입니다.
방화벽 설정을 통해 chrony 서비스에서 사용하는 기본 포트인 123 을 열어두어야 합니다.
B) 시간 동기화 서비스 기동 및 활성화
시간 동기화 서비스 기동 및 활성화
systemctl start chronyd systemctl enable chronyd
[root@ol9 ~]# systemctl start chronyd [root@ol9 ~]# systemctl enable chronyd Created symlink /etc/systemd/system/multi-user.target.wants/chronyd.service → /usr/lib/systemd/system/chronyd.service.
C) 서비스 기동 결과 확인
시간동기화 서비스 확인
timedatectl chronyc sources chronyc sourcestats chronyc sources -v chronyc tracking
[root@busan ~]# timedatectl Local time: 화 2024-04-02 09:44:36 KST Universal time: 화 2024-04-02 00:44:36 UTC RTC time: 화 2024-04-02 00:44:36 Time zone: Asia/Seoul (KST, +0900) System clock synchronized: yes NTP service: active RTC in local TZ: no [root@ol9 ~]# chronyc sources MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^* 192.168.0.70 3 6 37 24 +749ns[-5754ns] +/- 4952us [root@ol9 ~]# chronyc sourcestats Name/IP Address NP NR Span Frequency Freq Skew Offset Std Dev ============================================================================== 192.168.0.70 7 4 199 -0.082 0.498 -1004ns 14us [root@ol9 ~]# chronyc sources -v .-- Source mode '^' = server, '=' = peer, '#' = local clock. / .- Source state '*' = current best, '+' = combined, '-' = not combined, | / 'x' = may be in error, '~' = too variable, '?' = unusable. || .- xxxx [ yyyy ] +/- zzzz || Reachability register (octal) -. | xxxx = adjusted offset, || Log2(Polling interval) --. | | yyyy = measured offset, || \ | | zzzz = estimated error. || | | \ MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^* 192.168.0.70 3 6 17 45 -7890ns[ -23us] +/- 4885us [root@ol9 ~]# chronyc tracking Reference ID : C0A80C48 (192.168.12.70) Stratum : 4 Ref time (UTC) : Tue Apr 02 00:28:05 2024 System time : 0.000000004 seconds fast of NTP time Last offset : -0.000007447 seconds RMS offset : 0.000017282 seconds Frequency : 22.512 ppm slow Residual freq : -0.002 ppm Skew : 0.034 ppm Root delay : 0.003092050 seconds Root dispersion : 0.003388617 seconds Update interval : 130.3 seconds Leap status : Normal [root@ol9 ~]# chronyc sources MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^* 192.168.0.70 3 6 37 24 +749ns[-5754ns] +/- 4952us