Today we will discuss about Clock Offset issue or NTP service is not synchronized to any remote server. Due to this error my services on the host is not starting. We can fix this issue as follows:
- If you did not install ntp utility then install ntp using following command
# yum install ntp
- We can troubleshoot it by running following command
$ ntpq -np
In my case I got the following output
[root@quickstart cloudera]$ ntpq -np
remote refid st t when poll reach delay offset jitter
=============================================================================
10.2.254.225 122.246.56.250 3 u 361 1024 377 0.408 468604. 1937.59
10.2.65.234 10.2.64.220 4 u 391 1024 377 0.461 469115. 2361.97
Note:
If the row starting with a ‘*’ (if ntpdc) or ‘^*’ (if chronyc) contains the peer to which the host is currently synchronized. If no row starts with a ‘*’ or ‘^*’, this indicates that the host is not currently synchronized. We can see from the output and this host is not synchronized.
The following symbols may be displayed to the left of the server address:
* synchronization server (current time source)
+ server ready for update (which we can synchronize with)
— server not recommended for synchronization
x server unavailable
- Edit /etc/ntp.conf and add following lines into /etc/ntp.conf file
restrict <ipaddress> mask 255.255.255.0 nomodify notrap
logfile /var/log/ntp.log
The <ipaddress> should be the start of the IP address range that you want to be defined by the provided mask. For example, if your IP address range in 192.168.1.1 through 192.168.1.255, you’ll want: restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
- Save the file and again run ntpq -np to check the output.
[root@quickstart cloudera]# ntpq -np
remote refid st t when poll reach delay offset jitter
==============================================================================
*10.2.253.225 122.236.56.250 3 u 361 1024 377 0.408 468604. 1937.59
+10.2.65.234 10.2.64.220 4 u 391 1024 377 0.461 469115. 2361.97
The * symbol before the line will appear as shown above. Now check Host’s health you will find ntp is set on Cloudera user interface. There is another way you can simply try as described in below steps to fix this issue:
- Stop ntp service
#service ntpd stop
- Using the ntpdate command, we can set the local date and time on our server by sending a request to the NTP server:
#ntpdate -u <ntp server>
Note** <ntp server> = you can get this detail in cat /etc/ntp.conf and the last line server <ipaddress> prefer
You can check the current status of ntpd with the following command:
#ntpdc -c sysinfo
The output will look like the following:
system peer: usada-nlz80-vl254.xyz.net
system peer mode: client
leap indicator: 00
stratum: 4
precision: -20
root distance: 0.06343 s
root dispersion: 0.28523 s
reference ID: [10.2.65.234]
reference time: e214fb56.6450fd5f Thu, Mar 12 2020 14:17:36.391
system flags: auth monitor ntp stats
jitter: 0.037415 s
stability: 0.000 ppm
broadcastdelay: 0.000000 s
authdelay: 0.000000 s
- Restart NTP service
#service ntpd start
Check the services on the host. Issue is resolved now.