NTP_配置各个节点时间同步

以下为个人测试环境仅供参考:

172.16.1.11节点:

yum install -y ntp

vi /etc/ntp.conf

##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 127.127.1.0 iburst   --加这个

[root@hdfs ~]# systemctl restart ntpd.service

[root@hdfs ~]# systemctl status ntpd.service

 

172.16.1.12节点:

[root@db2 mnt]# netstat -anptu |grep 123   --测试端口开没开

[root@db2 mnt]# vi /etc/ntp.conf

##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 172.16.1.11

restrict 172.16.1.11 mask 255.255.0.0 nomodify notrap

[root@db2 mnt]# systemctl stop ntpd.service

必须关闭进程后才能同步主服务节点的时间,然后再重启,显示成功。

[root@db2 mnt]# ntpdate 172.16.1.11

 

systemctl restart ntpd.service

systemctl status ntpd.service

172.16.1.13节点:

[root@db2 mnt]# vi /etc/ntp.conf

##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 172.16.1.11

restrict 172.16.1.11 mask 255.255.0.0 nomodify notrap

[root@db3 ~]# systemctl stop ntpd.service

[root@db3 ~]# ntpdate 172.16.1.11

成功!!

 

systemctl restart ntpd.service

systemctl status ntpd.service

ntpdate -u 172.16.1.11   或不加u

同步后所有节点date检查时间同步情况。

设置开机自启:

 chkconfig ntpd on

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值