CentOS7 NTP服务

版权声明:本文为博主原创文章,转载请注明出处 https://blog.csdn.net/vkingnew/article/details/89159474
	
# sudo yum install ntp
# systemctl restart ntpd

# ntptime

有不少的服务严格依赖NTP服务,比如kudu和impala

# systemctl status ntpd
● ntpd.service - Network Time Service
   Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2019-04-09 19:27:22 CST; 4min 35s ago
  Process: 24483 ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS (code=exited, status=0/SUCCESS)
 Main PID: 24484 (ntpd)
   CGroup: /system.slice/ntpd.service
           └─24484 /usr/sbin/ntpd -u ntp:ntp -g

Apr 09 19:27:22 10-19-145-241 systemd[1]: Started Network Time Service.
Apr 09 19:27:22 10-19-145-241 ntpd[24484]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
Apr 09 19:27:22 10-19-145-241 ntpd[24484]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
Apr 09 19:27:22 10-19-145-241 ntpd[24484]: Listen and drop on 1 v6wildcard :: UDP 123
Apr 09 19:27:22 10-19-145-241 ntpd[24484]: Listen normally on 2 lo 127.0.0.1 UDP 123
Apr 09 19:27:22 10-19-145-241 ntpd[24484]: Listen normally on 3 eth0 10.19.145.241 UDP 123
Apr 09 19:27:22 10-19-145-241 ntpd[24484]: Listening on routing socket on fd #20 for interface updates
Apr 09 19:27:22 10-19-145-241 ntpd[24484]: 0.0.0.0 c016 06 restart
Apr 09 19:27:22 10-19-145-241 ntpd[24484]: 0.0.0.0 c012 02 freq_set ntpd 3.455 PPM
Apr 09 19:27:29 10-19-145-241 ntpd[24484]: 0.0.0.0 c615 05 clock_sync


# netstat -unlnp | grep ntp 
udp        0      0 10.19.145.241:123       0.0.0.0:*                           24484/ntpd          
udp        0      0 127.0.0.1:123           0.0.0.0:*                           24484/ntpd          
udp        0      0 0.0.0.0:123             0.0.0.0:*                           24484/ntpd          
udp6       0      0 :::123                  :::*                                24484/ntpd



# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*10.19.255.1     193.228.143.23   3 u    6    8  377    0.205   -8.326   2.512
+10.19.255.2     103.18.128.60    3 u    5    8  377    0.255  -10.341   0.893
+119.28.183.184  100.122.36.4     2 u    4    8  357   50.955  -18.462   2.089

# ntptime
ntp_gettime() returns code 5 (ERROR)
  time e057014c.cc2d7000  Tue, Apr  9 2019 19:32:28.797, (.797568),
  maximum error 16000000 us, estimated error 16000000 us, TAI offset 0
ntp_adjtime() returns code 5 (ERROR)
  modes 0x0 (),
  offset 0.000 us, frequency 0.000 ppm, interval 1 s,
  maximum error 16000000 us, estimated error 16000000 us,
  status 0x4041 (PLL,UNSYNC,MODE),
  time constant 7, precision 1.000 us, tolerance 500 ppm,


# returns code: 0 表示同步正常, 5 表示同步失败
# 它使用ntp_gettime() 系统调用读取并显示与时间相关的内核变量

相关的日志:
# tail -f /var/log/messages


参考:
https://kudu.apache.org/docs/troubleshooting.html

猜你喜欢

转载自blog.csdn.net/vkingnew/article/details/89159474