모든 로깅 시스템에서 가장 중요한 것은 시간 동기화입니다.
1. NTP 동기화를 설정하기
- CentOS 7
yum -y install ntpdate
ntpdate time.google.com
systemctl enable ntpdate
timedatectl
- CentOS 8
dnf -y install chrony
vi /etc/chrony.conf
#pool 2.centos.pool.ntp.org iburst
pool time.google.com iburst
systemctl enable --now chronyd
chronyc sources
dnf -y install ntpstat
ntpstat
timedatectl
chronyd -q 'server time.google.com iburst'
systemctl status chronyd
2. 부팅 시 자동으로 등록하기
- CentOS 7
#vi /etc/rc.d/rc.local ntpdate time.google.com chmod +x /etc/rc.local
- CentOS 8
#vi /etc/rc.d/rc.local if [ -f /usr/sbin/chronyd -a -f /etc/chrony.conf ]; then /usr/sbin/chronyd -r -s echo "Start chronyd" fi chmod +x /etc/rc.local
3. 참고 문헌
https://chrony.tuxfamily.org/manual.html