标签:
1现象:ntpd老是没法开启,ntpd -d显示有个进程占用123端口。
[root@vd13crmtb01 ~]# systemctl enable ntpd.service //开机自启动
调整之后重启系统,可是发现ntp并没有启动起来
[root@vd13crmtb01 ~]# pgrep ntpd //无法查看到相关进程
[root@vd13crmtb01 ~]# systemctl status ntpd
ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled)
Active: inactive (dead) //显示开机自启动了,但是状态是inactive
通过查询发现有一个chronyd服务设置为开机自启动,这个服务导致ntp无法开启自启动
2 查找占用进程:netstat -anpl |grep 123显示chronyd占用
[root@vd13crmtb01 ~]# systemctl status chronyd
chronyd.service - NTP client/server
Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled)
Active: inactive (dead) since Tue 2014-11-11 08:28:14 CST; 1min 45s ago
Main PID: 3033 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/chronyd.service
Nov 11 08:06:31 vd13crmtb01.zj.chinamobile.com systemd[1]: Starting NTP clien...
Nov 11 08:06:31 vd13crmtb01.zj.chinamobile.com chronyd[3033]: chronyd version...
Nov 11 08:06:31 vd13crmtb01.zj.chinamobile.com chronyd[3033]: Linux kernel ma...
Nov 11 08:06:31 vd13crmtb01.zj.chinamobile.com chronyd[3033]: hz=100 shift_hz...
Nov 11 08:06:31 vd13crmtb01.zj.chinamobile.com systemd[1]: Started NTP client...
Nov 11 08:28:14 vd13crmtb01.zj.chinamobile.com systemd[1]: Stopping NTP clien...
Nov 11 08:28:14 vd13crmtb01.zj.chinamobile.com systemd[1]: Stopped NTP client...
Hint: Some lines were ellipsized, use -l to show in full.
3 解决办法
通过禁止chronyd服务开机自启动之后再将系统重启
[root@vd13crmtb01 ~]# systemctl disable chronyd.service
rm ‘/etc/systemd/system/multi-user.target.wants/chronyd.service‘
[root@vd13crmtb01 ~]# pgrep ntpd
2981
[root@vd13crmtb01 ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
10.70.213.132 10.70.91.148 3 u 21 64 1 1.252 0.029 0.000
*10.70.213.133 10.70.91.148 3 u 21 64 1 1.139 -0.191 0.000
此时,NTP的服务已经开机自启动了,完成!
标签:
原文地址:http://www.cnblogs.com/zhouhbing/p/4318407.html