Linux配置时间服务器,linux配置服务器


[Author]: kwu 

Linux配置时间服务器,大数据集群时间同步是非常关键的,误差超过500ms就会有问题,通常配置内网的时间服务器。

本文以CentOS6.6为例介绍内网时间服务器的配置:

1、开启ntpd服务

chkconfig ntpd on
chkconfig --list ntpd



2、配置服务端
vi /etc/ntp.conf :
server us.pool.ntp.org minpoll 4
fudge 127.127.1.0 stratum 1
restrict 127.0.0.1
restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap
driftfile /var/lib/ntp/drift

vi /etc/ntp/step-tickers
us.pool.ntp.org 

3、配置客户端
1) vi /etc/ntp.conf
server 192.168.2.245
fudge 127.127.1.0 stratum 2
restrict 127.0.0.1
driftfile /var/lib/ntp/drift
restrict 192.168.2.245 mask 255.255.255.255

vi /etc/ntp/step-tickers文件内容置为时钟服务器IP地址 
192.168.2.245

2)或者
* * * * * /usr/sbin/ntpdate 192.168.2.245 | logger -t NTP


4、重启服务端与客户的ntp服务
service ntpd restart


5、测试时间同步
修改时间
date -s "2007-08-03 18:21:15"

同步时间后恢复正确时间,查看
date



相关内容