前言
通过ntp
命令,配置集群时间同步,实现内网时间同步
配置主机
确保 ntp 服务关闭状态
查看 ntp 服务状态
停止 ntp 服务
1 2
| service ntpd stop chkconfig ntpd off
|
确认关闭状态
开始配置
配置 ntp.conf 文件
去除注释
/etc/ntp.conf1
| restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
|
添加注释
/etc/ntp.conf1 2 3 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
|
添加当前节点
/etc/ntp.conf1 2
| server 127.127.1.0 fudge 127.127.1.0 stratum 10
|
配置 ntpd 文件
同步硬件时钟
/etc/sysconfig/ntpd
重启 ntp 服务
确认 ntp 服务状态
设置 ntp 服务开机启动
配置从机
添加计划任务
配置计划任务
1
| */1 * * * * /usr/sbin/ntpdate hadoop102
|
完成
参考文献
哔哩哔哩——zhvsvd