ntp的时间同步配置

ntp的时间同步配置

当搭建完成hadoop的集群搭建之后,我们先来做时区同步
在三台虚拟机上都使用以下命令安装 ntp

yum -y install ntp

然后在三台机器上都用以下命令设置ntp开机自启

chkconfig ntpd on

下面修改主机的ntp.conf文件

vi /etc/ntp.conf

在这里插入图片描述
如图取消注释 restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
如图注释掉四行 server 然后在下面添加:

server 127.127.1.0
fudge 127.127.1.0 stratum 10

另外两台的ntp.conf 的修改是一样的 如下操作
在这里插入图片描述
如图取消注释 restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
同样注释掉四行 server 然后在下面添加:

server 127.127.1.0
fudge 127.127.1.0 stratum 10
server hadoop001
restrict hadoop001 nomodify notrap noquery

其中hadoop001是你的主机名或者IP地址

启动 ntp 服务:

service ntpd start

三台虚拟机分别输入以下命令查看时间同步结果:

ntpstat

在这里插入图片描述
三台虚拟机执行完命令后都出现上图 synchronised to NTP server 即为时间同步成功

猜你喜欢

转载自blog.csdn.net/giantleech/article/details/115091469