網站首頁 編程語言 正文
一、環境配置
1.NTP服務器
NTP服務器版本:Red Hat Enterprise Linux release 8.0 (Ootpa) NTP服務器IP:192.168.8.11/24 NTP服務器hostname:node1
2.業務服務器
NTP服務器版本:Red Hat Enterprise Linux release 8.0 (Ootpa) NTP服務器IP:192.168.8.12/24 NTP服務器hostname:node2
二、NTP服務器配置
1.查看chrony服務狀態
[root@node1 ~]# systemctl status chronyd ● chronyd.service - NTP client/server Loaded: loaded (/usr/lib/systemd/system/chronyd.service; disabled; vendor preset: enabled) Active: inactive (dead) Docs: man:chronyd(8) man:chrony.conf(5) [root@node1 ~]#
2.啟動chrony服務
[root@node1 ~]# systemctl enable --now chronyd Created symlink /etc/systemd/system/multi-user.target.wants/chronyd.service → /usr/lib/systemd/system/chronyd.service.
3.關閉防火墻和selinux
[root@node1 ~]# systemctl status firewalld.service ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled) Active: inactive (dead) Docs: man:firewalld(1) [root@node1 ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config [root@node1 ~]# setenforce 0 setenforce: SELinux is disabled [root@node1 ~]# getenforce Disabled [root@node1 ~]#
4.配置NTP服務文件
[root@node1 ~]# vim /etc/chrony.conf [root@node1 ~]# cat /etc/chrony.conf |grep -Ei '(allow|local)' # Allow the system clock to be stepped in the first three updates # Allow NTP client access from local network. #allow 192.168.0.0/16 allow 192.168.8.0/24 local stratum 10 [root@node1 ~]#
5.重啟服務
[root@node1 ~]# systemctl restart chronyd [root@node1 ~]#
三、業務服務器配置
1.開啟chrony服務
[root@node2 ~]# systemctl enable --now chronyd Created symlink /etc/systemd/system/multi-user.target.wants/chronyd.service → /usr/lib/systemd/system/chronyd.service. [root@node2 ~]#
2.配置chrony服務文件
[root@node2 ~]# vim /etc/chrony.conf [root@node2 ~]# cat /etc/chrony.conf |grep pool # Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). pool 192.168.8.11 iburst [root@node2 ~]#
3.重啟服務
[root@node2 ~]# systemctl restart chronyd [root@node2 ~]#
四、測試業務服務器時間狀態
1.查看時間同步狀態
[root@node2 ~]# chronyc sources 210 Number of sources = 1 MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^? 192.168.8.12 0 7 0 - +0ns[ +0ns] +/- 0ns [root@node2 ~]#
2.立即時間同步
[root@node2 ~]# chronyc sources 210 Number of sources = 1 MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^* 192.168.8.11 10 6 17 2 +249ns[ +141us] +/- 100us [root@node2 ~]# chronyc sources -v 210 Number of sources = 1 .-- 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 =============================================================================== ^* 192.168.8.11 10 6 17 8 +249ns[ +141us] +/- 1103us [root@node2 ~]#
原文鏈接:https://blog.csdn.net/jks212454/article/details/121616176
相關推薦
- 2023-01-30 如何使用Flutter實現手寫簽名效果_Android
- 2022-07-25 python如何將自己的包上傳到PyPi并可通過pip安裝的方法步驟_python
- 2022-04-08 swift實現簡易計算器項目_Swift
- 2023-01-17 Golang?map實現原理淺析_Golang
- 2022-10-13 解析django的csrf跨站請求偽造_python
- 2022-07-06 R語言繪制條形圖及分布密度圖代碼總結_python
- 2022-07-06 python函數運行內存時間等性能檢測工具_python
- 2021-12-02 C++11?constexpr使用詳解_C 語言
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支