时间同步方式: 找一个机器,作为时间服务器,所有机器与这条集群时间进行定时的同步,比如每隔10分钟,同步一次时间

配置时间同步具体实操:
- 时间服务器配置(必须是 root 用户) 
- 检查ntp是否安装 - rpm -qa | grep ntp 
- 修改ntp配置文件 - vim /etc/net.conf 下面是参考配置 - a)修改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
 b)修改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为
 #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
 c)添加3(当该节点丢失网络连接,依然可以采用本地时间作为时间服务器为集群中的其他节点提供时间同步)
 server 127.127.1.0
 fudge 127.127.1.0 stratum 10
- 修改/etc/sysconfig/ntpd 文件 - : SYNC HWCLOCK=yes 
- 重新启动ntpd服务 - service ntpd status 
- 设置开机启动 - chkconfig ntpd on 
- 其他机器配置(必须是 root 用户) - 在其他机器配置10分钟与时间服务器同步一次 - crontab -e - * * * * /usr/sbin/ntpdate hadoop100 
- 可以测试 data -s “2020-2-1 16:46:20” 
 
