时间同步的方式:找一台机器作为时间服务器,将所有的机器与这台集群时间进行定时的同步,避免运行时间较长时或者部分机器断网情况下造成时间误差过大。
配置时间同步具体步骤:
1.1 选择时间服务器,在root用户下操作或者添加sudo权限
1.2 检查ntp是否安装: rpm -qa|grep ntp
ntp-4.2.6p5-10.el6.centos.x86_64
fontpackages-filesystem-1.41-1.1.el6.noarch
ntpdate-4.2.6p5-10.el6.centos.x86_64
1.3 关闭ntpd服务:
service ntpd stop(此次登陆关闭)
chkconfig ntpd off(开机自启关闭)
service ntpd status (查看ntp状态)
1.4 修改ntp配置文件: vim /etc/ntp.conf
1.4.1 修改1 :授权192.168.1.0-192.168.1.255网段上的所有机器可以从这台机器上查询和同步时间
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap为
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
1.4.2 修改2:集群在局域网中,不使用其他互联网上的时间
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
修改为
#ser
集群的时间同步配置步骤
最新推荐文章于 2023-03-16 22:46:27 发布