CentOS8中默认已经不再支持ntpd软件包,同时也无法通过官方软件仓库安装, CentOS8上使用Chrony配置NTP服务器,用于同步时间。 它有两个程序,chrony和chronyd, chronyd是守护进程 ,chrony是一个命令行界面程序,可以用来监控chronyd的性能,并修改各种操作参数。

安装chrony
系统会默认安装并启动,如果系统不存在则需要安装此工具库。

仓库中直接安装

dnf -y install chrony

 启动守护进程

systemctl enable –now chronyd

时间同步配置

设置时区
联网的情况下一般设置时区后会通过网络同步时间

timedatectl set-timezone "Asia/Shanghai"

配置chrony.conf

修改配置加入aliyun pool网络时间,也可以加入多个pool服务器
vim /etc/chrony.conf

# Use public servers from the pool.ntp.org project.

# Please consider joining the pool (http://www.pool.ntp.org/join.html).

pool 2.centos.pool.ntp.org iburst

pool ntp.aliyun.com iburst

# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift
# Allow the system clock to be stepped in the first three updates
# if its offset is larger than 1 second.
makestep 1.0 3 # Enable kernel synchronization of the real-time clock (RTC).
rtcsync # Enable hardware timestamping on all interfaces that support it.
#hwtimestamp * # Increase the minimum number of selectable sources required to adjust
# the system clock.
#minsources 2 # Allow NTP client access from local network.
#allow 192.168.0.0/16 # Serve time even if not synchronized to a time source.
#local stratum 10 # Specify file containing keys for NTP authentication.
keyfile /etc/chrony.keys # Get TAI-UTC offset and leap seconds from the system tz database.
leapsectz right/UTC # Specify directory for log files.
logdir /var/log/chrony # Select which information is logged.
#log measurements statistics tracking

重新加载配置

systemctl restart chronyd.service

时间同步

执行时间同步命令

chronyc sources -v

[root@k8smaster ~]# chronyc sources -v

210 Number of sources = 5

.-- Source mode ‘^’ = server, ‘=’ = peer, ‘#’ = local clock.
/ .- Source state ‘*’ = current synced, ‘+’ = combined , ‘-’ = not combined,
| / ‘?’ = unreachable, ‘x’ = time may be in error, ‘~’ = time too variable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | |
MS Name/IP address Stratum Poll Reach LastRx Last sample

^- ntp5.flashdance.cx 2 6 377 6 +8255us[+8255us] +/- 139ms
^- 185.216.231.25 2 7 13 6 +10ms[ +10ms] +/- 98ms
^- 119.28.206.193 2 6 377 9 +1016us[+1001us] +/- 62ms
^* dns1.synet.edu.cn 2 6 377 8 -1423us[-1438us] +/- 9294us
^+ 203.107.6.88 2 6 377 7 +2107us[+2107us] +/- 17ms

验证查看时间
查看当前系统时间
date

CentOS8时间同步的更多相关文章

  1. CentOS8安装ntp实现时间同步

    在CentOS8.0中默认不再支持ntp软件包,时间同步将由chrony来实现,像我这种习惯了ntp同步时间的,一时难以去适应chrony. 本文将通过wlnmp提供的源,来安装ntp服务 添加wln ...

  2. 虚拟机上安装centos8.0

    一.准备宿主机 为了培训Hadoop生态的部署和调优技术,需要准备3台虚拟机部署Hadoop集群环境,能够保证HA,即主要服务没有单点故障,可执行基本功能,完成小内存模式的参数调整. 1.1.准备安装 ...

  3. Centos8最小化部署安装OpenStack Ussuri

    #!/bin/bash #Centos8最小化部署安装OpenStack Ussuri #共两台主机,分别是一台控制节点,一台计算节点 #.控制节点内存4096M.双网卡,分别为eth0:10.0.0 ...

  4. centos8使用timedatectl管理时间

    一,centos8中默认使用chronyd来做时间服务 1,查看chronyd服务的状态 [root@blog ~]# systemctl status chronyd ● chronyd.servi ...

  5. centos 8.x系统配置chrony时间同步服务

    redhat/centos 7.x默认使用的时间同步服务为ntp服务,但是从redhat/centos 8开始在官方的仓库中移除了ntp软件,换成默认的chrony进行时间同步的服务,虽然也可以通过添 ...

  6. 服务器时间同步架构与实现chrony

    实验背景 模拟企业局域服务器时间同步,保障各服务器系统准确性和时间一致性. 时间服务器系统搭建 实验架构图 环境设备 设备IP规划 国内互联网NTP服务器 ntp.aliyun.com #阿里云NTP ...

  7. 设置WindowServer2012 时间同步NTP

    在powershell中以管理员身份运行以下命令即可 w32tm /config /manualpeerlist:pool.ntp.org /syncfromflags:MANUAL Stop-Ser ...

  8. Hadoop技巧(02):时间同步

    阅读目录 序 时间同步 系列索引 本文版权归mephisto和博客园共有,欢迎转载,但须保留此段声明,并给出原文链接,谢谢合作. 文章是哥(mephisto)写的,SourceLink 序 在实际部署 ...

  9. linux 时间同步的2种方法

    转载自: http://blog.51yip.com/server/1474.html 由于硬件的原因,机器或多或少的根标准时间对不上,一个月的误差几秒到几分钟不等.对于服务器来说时间不准,会有很多麻 ...

随机推荐

  1. Guava学习之EventBus

    一.EventBus的使用案例 EventBus是Guava的事件处理机制,是设计模式中的观察者模式(生产/消费者编程模型)的优雅实现.对于事件监听和发布订阅模式,EventBus是一个非常优雅和简单 ...

  2. mac不能用ip访问项目的, 还有80端口不能开启的问题

    开启80端口 参考这篇文章 解决mac无法使用80端口问题,亲测可用 1. 防火墙设置问题 2. 网卡问题 3. 服务器地址配置问题

  3. MySQL-MMM高可用架构

    MySQL-MMM高可用架构 目录 MySQL-MMM高可用架构 一.MMM 1. MMM的概述 2. MMM的应用场景 3. MMM的特点 4. 关于MMM高可用架构的说明 5. 用户及授权 二.案 ...

  4. 栈(stack)、递归(八皇后问题)、排序算法分类,时间和空间复杂度简介

    一.栈的介绍: 1)栈的英文为(stack)2)栈是一个先入后出(FILO-First In Last Out)的有序列表.3)栈(stack)是限制线性表中元素的插入和删除只能在线性表的同一端进行的 ...

  5. 《PHP程序员面试笔试宝典》——如何应对面试官的“激将法”语言?

    如何巧妙地回答面试官的问题? 本文摘自<PHP程序员面试笔试宝典> "激将法"是面试官用以淘汰求职者的一种惯用方法,它是指面试官采用怀疑.尖锐或咄咄逼人的交流方式来对求 ...

  6. 树莓派GPIO开发(二)RGB模块-PWM调节

    配置环境 系统:Raspbian11(官方64位) 设备:树莓派CM4 一.PWM简单介绍 全称:Pulse-width modulation,脉冲宽度调制,简单的数模转换方法 1.基本原理 脉冲宽度 ...

  7. 手把手教你把 Git 子模块更新到主项目

    本文以 skywalking-rocketbot-ui子模块合并到 skywalking 为例,手把手教你如何把 Git 子模块更新到主项目中去. 首先,把fork的skywalking项目克隆到本地 ...

  8. JVM内存结构的组成、各部分功能作用

    一.程序计数器  作用:是记住下一条jvm指令的执行地址  特点: 是线程私有的 不会存在內存溢出 二.虚拟机栈 每个线程运行时所需要的内存,称为虚拟机栈 每个栈由多个栈帧(Frame) 组成,对应着 ...

  9. Prometheus之Dockerfile编写、镜像构建、容器启动

    目录 从官方镜像启动:prom/prometheus 官方Dockerfile分析 编写自己的Dockerfile 构建镜像: 启动容器: 从官方镜像启动:prom/prometheus 拉取镜像 $ ...

  10. CobaltStrike逆向学习系列(5):Bypass BeaconEye

    这是[信安成长计划]的第 5 篇文章 关注微信公众号[信安成长计划] 0x00 目录 0x01 BeaconEye 检测原理 0x02 Bypass 1 0x03 Bypass 2 0x04 效果图 ...