ntpstat는 작동하지만 ntpq는 작동하지 않습니다.

ntpstat는 작동하지만 ntpq는 작동하지 않습니다.

RHEL7.4에서 NTP 클라이언트를 구성하려고 하는데 "ntpstat" 명령을 실행하여 동기화되었는지 확인합니다.

[root@my-machine ~]# ntpstat
synchronised to NTP server (ntp-server ip) at stratum 5
   time correct to within 1173 ms
   polling server every 64 s

그러나 "ntpq -p" 명령을 실행하면 다음 오류가 발생합니다.

[root@my-machine ~]# ntpq -p
localhost.ntp-server.com: timed out, nothing received
***Request timed out

어떤 이유로 NTP는 NTP 서버 호스트 이름에 "localhost" 접두사를 추가했습니다.

이것은 내 /etc/ntp.conf입니다:

[root@my-machine ~]# egrep -v '^#|^[[:blank:]]*$' /etc/ntp.conf
driftfile /var/lib/ntp/drift
restrict default nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict ::1
server ntp-server.com prefer iburst

NTP 동기화를 보장하려면 "ntpq -np"를 사용하여 "ntpq" 명령이 Cloudera 클러스터 및 cloudera-agent 시스템의 일부로 작동하도록 해야 합니다.

답변1

이 문제를 해결했습니다. 이상한 이유로 localhost 행이 /etc/hosts에서 전혀 누락되었습니다.

그래서 /etc/hosts에 다음 줄을 추가합니다.

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

이 줄을 추가하면 문제가 해결되었습니다.

관련 정보