CC00009.NavigationLog——|NTP.V02|

一、配置主机时间同步:
### --- 查看当前服务端和客户端版本一致

[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
二、ntp.server端配置:hadoop01
### --- 进行外网时间同步

~~~		# Hadoop01安装ntpdate
[root@localhost ~]# yum  install -y ntpdate
~~~		# 启动ntpdate
[root@localhost ~]# systemctl start ntpdate
[root@localhost ~]# systemctl enable ntpdate
~~~		# 通过网络连接外网进行时钟同步,必须保证虚拟机连上外网
[root@localhost ~]#  ntpdate us.pool.ntp.org;
17 Oct 12:56:25 ntpdate[7683]: adjust time server 50.205.57.38 offset 0.007918 sec

~~~		# 阿里云时钟同步服务器
[root@localhost ~]# ntpdate ntp4.aliyun.com 
17 Oct 12:57:22 ntpdate[7684]: adjust time server 203.107.6.88 offset -0.007126 sec

~~~		注:集群中其他机器与这台机器定时的同步时间,比如,每 隔十分钟,同步一次时间。
### --- 时间服务器配置(必须root用户)

~~~		# 安装ntpd服务
[root@localhost ~]# yum -y install ntp
### --- 编辑/etc/ntp.conf

~~~		# 编辑/etc/ntp.conf配置文件
[root@localhost ~]# vim /etc/ntp.conf
restrict default nomodify notrap nopeer noquery                             //第8行:开启配置始终同步广播地址
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap                     //开启17行;同步源:配置同步源

# server 0.centos.pool.ntp.org iburst                                       //第21~24行:注释掉
# 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 # local clock                                            //第25~26行:添加这两行
fudge 127.127.1.0 stratum 10
### --- 配置以下内容,保证BIOS与系统时间同步 vim /etc/sysconfig/ntpd添加一行内容

~~~		# 配置BIOS时间与系统时间同步
[root@localhost ~]# vim /etc/sysconfig/ntpd
SYNC_HWLOCK=yes
### --- 启动ntpd并设置开机自启动

~~~		# 启动ntpd服务
[root@localhost ~]# systemctl restart ntpd
[root@localhost ~]# systemctl enable ntpd
三、配置ntp.client端配置
### --- 配置ntp.client端服务:Hadoop02,Hadoop03

~~~		# 安装ntpdate服务
[root@localhost ~]# yum install -y ntpdate
~~~		# 启动ntpdate
[root@localhost ~]# systemctl start ntpdate
[root@localhost ~]# systemctl enable ntpdate
~~~		# 在其他机器配置10分钟与时间服务器同步一次

[root@localhost ~]# crontab -e
*/10 * * * * /usr/sbin/ntpdate 192.168.1.121                          //注:另外两台机器与192.168.1.121进行时钟同步
~~~		# 修改任意机器时间
[root@localhost ~]# date -s "2020-06-20 11:11:11"

~~~		# 十分钟后查看机器是否与时间服务器同步
[root@localhost ~]# date
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yanqi_vip

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值