1、集群时间同步(主节点)
1.1 rpm -qa |grep ntpd 》》没有安装则需要安装此服务 》》yum install ntp
2.2 vi /etc/ntp.conf
去掉这个注释,将地址改成网段地址
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
注释掉这几个
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
添加一下内容
server 0.asia.pool.ntp.org
server 3.asia.pool.ntp.org
restrict 0.asia.pool.ntp.org nomodify notrap noquery
restrict 3.asia.pool.ntp.org nomodify notrap noquery
server 127.127.1.0
fudge 127.127.1.0 stratum 10
1.3 vi /etc/sysconfig/ntpd 加入下面一句话,用于配置boot时间和系统时间同步
SYNC_HWCLOCK=yes
1.4 启动ntpd服务器
ntpdate -u 3.asia.pool.ntp.org
sudo service ntpd start
sudo service ntpd status
chkconfig ntpd on
chkconfig --list |grep ntpd
2、客户机配置(从节点)
2.1 使用 root用户操作
去掉这个注释,将地址改成网段地址
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
注释掉这几个
# server 0.centos.pool.ntp.org iburst
# server 1.centos.pool.ntp.org iburst
# server 2.centos.pool.ntp.org iburst
# server 3.centos.pool.ntp.org iburst
添加一下内容(下边的192.168.1.46表示主节点地址)
server 192.168.1.46
restrict 192.168.1.46 nomodify notrap noquery
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
2.2 启动ntpd客服端
ntpdate -u 192.168.1.46
sudo service ntpd start
sudo service ntpd status
chkconfig ntpd on
chkconfig --list |grep ntpd