构建机房运维基础架构(十三): 搭建NTP服务

安装:

yum -y install ntp ntpdate

配置文件:

<pre># ntp.conf: Managed by puppet.
#
# Keep ntpd from panicking in the event of a large clock skew
# when a VM guest is suspended and resumed.
tinker panic 0

# Permit time synchronization with our time source, but do not'
# permit the source to query or modify the service on this system.'
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
server 0.pool.ntp.org
server 1.pool.ntp.org
server stdtime.gov.hk

# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available.
server 127.127.1.0
fudge 127.127.1.0 stratum 10
restrict 127.127.1.0


# Driftfile.
driftfile /var/lib/ntp/drift

 

其他机器同步时间用:


/usr/sbin/ntpdate $ntp_server_ip &>/dev/null ;clock -w

另外:

1.ntp server 配置文件 和其他机器同步命令 都用Puppet管理。

2.最好要两台NTP 服务器(接入一台交换机),起一个VIP指向这两台机器,并且在接入交换机上打开 源IP、源端口、目的IP、目的端口 的哈希功能(在等价路由基础上),这其实是实现了流量的负载均衡和高可用(具体咨询搞网络的同学)。

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注