CentOS7---时间同步

20 篇文章 0 订阅
1 篇文章 0 订阅

CentOS7—时间同步(笔录)

今天在学习etcd集群搭建时遇到时间不同步错误,故做笔记记录一下,错误信息如下:
与对等端47856ed020c3771a的时钟差太大

2020-12-24 10:23:26.649584 W | rafthttp: the clock difference against peer 47856ed020c3771a is too high [4.070577968s > 1s] (prober "ROUND_TRIPPER_SNAPSHOT")
2020-12-24 10:23:31.650852 W | rafthttp: the clock difference against peer 47856ed020c3771a is too high [4.066382795s > 1s] (prober "ROUND_TRIPPER_RAFT_MESSAGE")

在这里插入图片描述
找到对应的节点:47856ed020c3771a ---- > 192.168.6.12:2380
在这里插入图片描述

1、安装ntp服务

yum -y install ntp

2、设置时间

[root@hdss7-12 etcd]# ntpdate 0.asia.pool.ntp.org
24 Dec 10:34:57 ntpdate[1879]: step time server 45.76.111.149 offset -0.783300 sec

注:
这里主要就是通过时间服务器对系统时间进行同步,所以0.asia.pool.ntp.org并不是固定的,大家可以选择time.nist.gov、time.nuri.net、0.asia.pool.ntp.org、1.asia.pool.ntp.org、2.asia.pool.ntp.org、3.asia.pool.ntp.org中任意一个,只要保证可用就OK。

3、将系统时间写入硬件时间

hwclock --systohc

4、检查ntp服务是否为开机自启

[root@hdss7-12 etcd]# systemctl list-unit-files --type service |grep ntp
ntpd.service                                  disabled
ntpdate.service                               disabled

5、设置为开机自启

systemctl enable ntpd.service 
systemctl enable ntpdate.service 
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值