写于2013年秋,CentOS6.4
服务器端
[hadoop@master1 ~]$ sudo chkconfig ntpd on
[hadoop@master ~]$ sudo vi /etc/ntp.conf
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
[hadoop@master1 ~]$ sudo service ntpd start
客户端
[hadoop@master2 ~]$ sudo crontab -e
0 */1 * * * /usr/sbin/ntpdate ntp && /sbin/hwclock -w
在五分钟内会报:no server suitable for synchronization found,是因为NTP server需要跟其他服务器同步,包括自己
报“the NTP socket is in use, exiting”是因为本机ntpd服务已起,关掉即可。
sudo service ntpd stop #关掉服务
sudo chkconfig ntpd off #去掉重启自启动