@tsing1226
        
        2015-12-30T08:03:47.000000Z
        字数 724
        阅读 835
    linux
- 找一台机器作为时间服务器;
 - 所有机器都有这台时间服务器同步时间。
 
sudo rpm -qa | grep ntp
sudo service ntp status
 sudo service ntp start
sudo chkconfig ntpd on
sudo chkconfig --list | grep ntpd
 cp  /etc/ntp.conf  /etc/ntp.bak.conf
修改内容如下:
    第一处:去掉注释,修改网段   
        # Hosts on local network are less restricted.
        restrict 192.168.2.101 mask 255.255.255.0 nomodify notrap
    第二处:增加注释
        #server 0.centos.pool.ntp.org
        #server 1.centos.pool.ntp.org
        #server 2.centos.pool.ntp.org
    第三处:去掉注释
        server  127.127.1.0     # local clock
        fudge   127.127.1.0 stratum 10
sudo service ntpd restart
    $ sudo vi /etc/sysconfig/ntpd
首行增加如下内容:
        `SYNC_HWCLOCK=yes`
所有的机器都与这台时间服务器进行同步时间
(定时任务,每过一段时间与时间服务器进行同步时间)
0-59/10 * * * * /usr/sbin/ntpdate bigdata-senior01.ibeifeng.com
