ntp搭建与部署

在每个主机执行命令

yum install ntp -y

在主节点修改/etc/ntp.conf, 可直接copy,这里完全用主节点的时间,不依赖其他时间服务器

driftfile /var/lib/ntp/drift
restrict default nomodify
restrict 127.0.0.1 
restrict ::1

# Enable public key cryptography.
# #crypto
#
includefile /etc/ntp/crypto/pw
#
# # Key file containing the keys and key identifiers used when operating
# # with symmetric key cryptography. 
keys /etc/ntp/keys
#
server 127.127.1.0
fudge 127.127.1.0 stratum 10

在其他节点修改/etc/ntp.conf如下

driftfile /var/lib/ntp/drift
restrict default nomodify
restrict 127.0.0.1 
restrict ::1

# Enable public key cryptography.
#crypto

includefile /etc/ntp/crypto/pw

# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography. 
keys /etc/ntp/keys

server 192.168.16.4#主节点ip

最后在每个节点执行命令(主节点最先执行)

systemctl enable ntpd
systemctl restart ntpd

查看ntp信息,执行

[root@ceph-1 deploy]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*LOCAL(0)        .LOCL.          10 l   60   64  377    0.000    0.000   0.000

你可能感兴趣的:(ntp搭建与部署)