리눅스 ntpd(혹은 chrony)와 timesyncd 같이 쓰지 말 것
결론부터 말하면, 시간 동기화 데몬은 서버에 한 개만 실행 중이어야 한다.
추가내용: 서버 시간 동기화: 제발 21세기엔 rdate 쓰지 말자
systemd를 사용하는 리눅스 서버의 시간 동기화를 설명하는 인터넷의 여러 글 중에 ntpd(혹은 chrony) 설치와 함께 timesyncd 를 같이 활성화하라는 내용이 여럿 있다.
# timedatectl
Local time: 금 2020-06-19 00:34:37 KST
Universal time: 목 2020-06-18 15:34:37 UTC
RTC time: 목 2020-06-18 15:34:37
Time zone: Asia/Seoul (KST, +0900)
System clock synchronized: yes
NTP service: inactive
RTC in local TZ: no
위 명령 실행 결과에서 NTP Service 항목이 active 로 나와야 한다는건데, timedatectl 에서 말하는 NTP Service 는 ‘systemd-timesyncd’ 이다. timedatectl set-ntp on 한 뒤에 확인해보라.
# timedatectl set-ntp on
# timedatectl
Local time: 금 2020-06-19 00:39:24 KST
Universal time: 목 2020-06-18 15:39:24 UTC
RTC time: 목 2020-06-18 15:39:24
Time zone: Asia/Seoul (KST, +0900)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
# systemctl status systemd-timesyncd
● systemd-timesyncd.service - Network Time Synchronization
Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled; vendor p>
Active: active (running) since Fri 2020-06-19 00:39:20 KST; 35s ago
Docs: man:systemd-timesyncd.service(8)
Main PID: 588613 (systemd-timesyn)
Status: "Initial synchronization to time server 211.233.40.78:123 (0.arch.pool.ntp.o>
Tasks: 2 (limit: 9414)
Memory: 1.8M
CGroup: /system.slice/systemd-timesyncd.service
└─588613 /usr/lib/systemd/systemd-timesyncd
6월 19 00:39:20 Arch systemd[1]: Starting Network Time Synchronization…
6월 19 00:39:20 Arch systemd[1]: Started Network Time Synchronization.
6월 19 00:39:21 Arch systemd-timesyncd[588613]: Initial synchronization to time server
한 시스템에 두 개 이상의 시간 동기화 데몬이 실행되면 서버 시간이 널뛰기 할 수 있다.
참고로 systemd-timesyncd 는 SNTP 구현체로 NTP 클라이언트 역할만 함. 2020 년 현재 NTP 구현체 중 chrony 쓰는게 가장 낫다.
제가 지금 밖이라 자세한 자료를 던져드리기가 좀 곤란한데https://t.co/b7YxaOL3Nr
— 김지현 (@simnalamburt) January 29, 2019
말씀하신 동작을 slew라고 하는데 ntpd가 그거 지원 안하는건 아닌데 문제가 좀 많아유
그리고 systemd-timesyncd는 NTP가 아니라 SNTP 클라이언트라서 slewing, leap smearing 이런거 하나도안됩니다 pic.twitter.com/ZCC2RN3vMg
NTP 는 시간 동기화 자주 한다고 정밀도가 높아지지 않는다
NTP 를 1 분마다 실행한다고 오차가 작아지지 않는다. 오히려 반복 실행 시 뒤에 실행되는 동기화 명령은 무시된다.
답글 남기기