NTP服务在大数据集群部署时时一个很关键的步骤,集群时间不对会导致很多问题
1.yum安装ntp服务
yum -y install ntp
离线安装需要三个包
ntp.x86_64 0:4.2.6p5-28.el7.centos
autogen-libopts.x86_64 0:5.18-5.el7
ntpdate.x86_64 0:4.2.6p5-28.el7.centos
2.配置服务端 vi /etc/ntp.conf
配置服务端 vi /etc/ntp.conf
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
#修改为--允许192.168.11.x网段内所有的主机访问
restrict 192.168.11.0 mask 255.255.255.0 nomodify notrap
#注释掉下面的4行
#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 ntp1.aliyun.com
server time1.aliyun.com
server 127.127.1.0 # 本地时钟服务器
3.服务端测试—主要是2个命令,具体含义可以自行Google
重启ntp服务
systemctl restart ntpd
查看同步状态
[root@cdh11 network-scripts]# ntpq -p
remote refid st t when poll reac