CentOS 9 时钟同步

VMware版本:VMware Workstation 16 Pro 16.2.1 build-18811642
系统镜像:CentOS-Stream-9-20250224.1-x86_64-dvd1.iso
主机:hbase1(192.168.200.139);hbase2(192.168.200.140);hbase3(192.168.200.141)

1.安装chrony

操作机:hbase1 hbase2 hbase3

yum -y install chrony

2.启动服务

操作机:hbase1 hbase2 hbase3

systemctl start chronyd ``` [root@hbase3 ~]# systemctl status chronyd ● chronyd.service - NTP client/server Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; p> Active: active (running) since Wed 2025-03-19 08:20:37 CST; 18min a> Docs: man:chronyd(8) man:chrony.conf(5) Process: 747 ExecStart=/usr/sbin/chronyd $OPTIONS (code=exited, stat> Main PID: 759 (chronyd) Tasks: 1 (limit: 24539) Memory: 4.7M CPU: 648ms CGroup: /system.slice/chronyd.service └─759 /usr/sbin/chronyd -F 2 ```

3.开机自启动

操作机:hbase1 hbase2 hbase3

systemctl enable chronyd

4.关闭防火墙

操作机:hbase1 hbase2 hbase3

systemctl stop firewalld systemctl disable firewalld

5.配置

操作机:hbase1

vi /etc/chrony.conf
#pool 2.centos.pool.ntp.org iburst
server ntp.ntsc.ac.cn iburst

(省略)

#allow 192.168.0.0/16
allow all

操作机:hbase2 hbase3

#pool 2.centos.pool.ntp.org iburst
server 192.168.200.139

6.重启和查看

操作机:hbase1 hbase2 hbase3

systemctl restart chronyd chronyc sources -v
[root@hbase1 ~]# chronyc sources -v

  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current best, '+' = combined, '-' = not combined,
| /             'x' = may be in error, '~' = too variable, '?' = unusable.
||                                                 .- 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               
===============================================================================
^? 114.118.7.161                 1   7   140    35    +20ms[  +20ms] +/-   14ms

[root@hbase2 ~]# chronyc sources -v

  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current best, '+' = combined, '-' = not combined,
| /             'x' = may be in error, '~' = too variable, '?' = unusable.
||                                                 .- 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               
===============================================================================
^* hbase1                        3   6   370   238  +5383ns[  +59us] +/-  422ms

[root@hbase3 ~]# chronyc sources -v

  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current best, '+' = combined, '-' = not combined,
| /             'x' = may be in error, '~' = too variable, '?' = unusable.
||                                                 .- 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               
===============================================================================
^? hbase1                        3   6    10   253    -21ms[  -21ms] +/-  416ms
posted @ 2025-03-19 09:07  基础狗  阅读(92)  评论(0)    收藏  举报