본문 바로가기
가상화/Nutanix

[Nutanix] The CVM is not synchronizing time with any external servers.

by JINJINC 2024. 3. 7.
728x90
반응형

Nutanix error message

The CVM is not synchronizing time with any external servers.

 

1 to find the NTP leader 
nutanix@cvm$ allssh ntpq -pn 

nutanix@cvm$ allssh ntpq -pn 
================== 192.168.1.aaa =================
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*127.127.1.0     .LOCL.          10 l   63   64  377    0.000    0.000   0.000  <--- Synchronized with a configured external NTP server
================== 192.168.1.bbb =================
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 192.168.1.aaa   LOCAL(0)        11 u   16   64    1    0.215   -0.623   0.000  <--- Synchronized with the CVM NTP leader 192.168.1.108
================== 192.168.1.ccc =================
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*192.168.1.aaa   LOCAL(0)        11 u   79  128  177    2.166  1000.22 1414.26  <--- Synchronized with the CVM NTP leader 192.168.1.108

 


2. Verify communication with cvm ntp leader
nutanix@cvm:~$ allssh ntpdate -q <cvm_ip_ntp_leader>
nutanix@cvm~$ allssh ntpdate -q 192.168.1.aaa  => 서버 통신 확인 

3. Check communication with external ntp server => 외부 ntp서버와의 통신확인 
nutanix@cvm$ /usr/sbin/ntpdate -t 10 -q <ntp_server>


ntp 서버와 통신이 제대로 되어야지 호스트의 시간이 제대로 동기화 되어진다. 

 

<ntp 서버가 없는경우>

 

1. ntp 서버 확인 
allssh ssh root@192.168.5.1 ntpq -p

2. Check NTP server  => ntp 서버 추가 
allssh ssh roo@192.168.5.1 service ntpd stop    => ntpd 서비스 중단
allssh ssh root@192.168.5.1 ntpd -u <ntp 서버 ip>  => 서버 추가
allssh ssh root@192.168.5.1 service ntpd start   => ntpd 서비스 시작

만약 프리즘에 ntp 경고 폭탕을 받는경우 (이런 경우 만일의 경우를 위해 support 를 요청하는것이 좋다.)
* ntp 서버가 udp 통신을 하여 ntp alert을 줄일 수 있다.
su nc -uv [ntp server] 123 => 몇분동안 기다리다가 ctrl+c로 종료, 
-u => udp 연결을 설정함 
-v => 보다 자세한 정보 제공 

3. nutanix@CVM:~$ allssh "grep offset ~/data/logs/genesis.out|tail"-> offset이 되는지 확인
offset이란? 상쇄시키다는 단어로, ntp 서버와의 시간차이가 줄어들고 있는지 확인할 수 있는 것 

nutanix@NTNX-18SM57320418-A-CVM:192.168.1.XXX:~$ allssh "grep offset ~/data/logs/genesis.out|tail"
================== 192.168.1.aaa =================
2024-03-07 09:28:04 INFO time_manager_utils.py:49 NTP offset: -1623.045 seconds
2024-03-07 09:38:22 INFO time_manager_utils.py:49 NTP offset: -1611.046 seconds
2024-03-07 09:48:38 INFO time_manager_utils.py:49 NTP offset: -1599.036 seconds
2024-03-07 09:58:54 INFO time_manager_utils.py:49 NTP offset: -1583.026 seconds
2024-03-07 10:09:21 INFO time_manager_utils.py:49 NTP offset: -1570.063 seconds
2024-03-07 10:19:36 INFO time_manager_utils.py:49 NTP offset: -1555.060 seconds
================== 192.168.1.ccc =================
================== 192.168.1.bbb =================

4.NTP 서버 동기화 

ntpdate -d [외부 ntp 서버]

5. 시간차이가 많이 나는 경우 =>timedrift script를 사용함(권장사항) ***

nutanix@CVM:~$ allssh '(/usr/bin/crontab -l && echo "*/5 * * * * bash -lc /home/nutanix/serviceability/bin/fix_time_drift") | /usr/bin/crontab -'

 

crontab -l 을 사용하여 crontab에 추가되었는지 확인 

nutanix@CVM:~$ allssh '(/usr/bin/crontab -l && echo "*/5 * * * * bash -lc /home/nutanix/serviceability/bin/fix_time_drift") | /usr/bin/crontab -'


=> 시간 주기는 해당 서버가 이 스크립트를 돌리는 시간이 얼마나 걸리는지 한번 실행해본 후 , 부하가 걸리지 않는 정도의 수준으로 돌리는것이 좋다. 

 

*스크립트 위치 cvm 에서 /home/nutnaix/serviceability/bin/fix_time_drift 에 위치함  

 

*제대로 적용되지 않는다면 Nutanix support에 문의해봐야 한다.

그 후  allssh "grep offset ~/data/logs/genesis.out|tail" 명령어를 이용하여 offset이 진행되는지 확인한다. 

6. 시간이 맞춰졌다면

nutanix@CVM:~$ allssh "(/usr/bin/crontab -l | sed '/fix_time_drift/d' | /usr/bin/crontab -)"
-> 전체 cvm crontab에서 삭제

7.호스트의 시간도 확인해줌
Hostsh ntpq -pn

 

host 는 외부 ntp 서버로 호스트 각각 동기화되지만, 
cvm은 서로서로를 바라보고 cvm-ntp leader의 시간을 동기화 한다면

728x90
반응형

댓글