欧美一区2区三区4区公司二百,国产精品婷婷午夜在线观看,自拍偷拍亚洲精品,国产美女诱惑一区二区

Linux公共服務組件之時間同步chrony

一、簡介

定義:chrony 是網絡時間協議(NTP)的通用實現。

chrony 包含兩個程序:chronyd 是一個可以在啟動時啟動的守護程序。chronyc 是一個命令行界面程序,用于監視 chronyd 的性能并在運行時更改各種操作參數。

時間概念:

UTC (Universal Time Coordinated):世界標準時間,屬于世界統一世界

GMT (Greenwich Mean Time):英國倫敦郊區的皇家格林尼治天文臺的標準時間,因為本初子午線被定義在通過那里的經線。(UTC與GMT時間基本相同,因此不做區分)

CST (China Standard Time):中國標準時間,CMT + 8 = UTC + 8 = CST

DST(Daylight Saving Time):夏令時指在夏天太陽升起的比較早時,將時間撥快一小時,以提早日光的使用。

二、安裝配置

測試環境:

IP 備注
120.10.10.10 Chrony服務
120.10.10.11 Chrony客戶端

服務端和客戶端均安裝軟件包:

yum -y install chrony
systemctl enable chronyd
systemctl start chronyd

服務端配置,注意兩個改動:

# 使用 pool.ntp.org 項目中的公共服務器。以server開,理論上想添加多少時間服務器都可以。
# 建議添加ping較低的公網服務器地址
# 改動1
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server ntp.aliyun.com iburst
server time.asia.apple.com iburst
server time.windows.com iburst
server cn.pool.ntp.org iburst

# 根據實際時間計算出服務器增減時間的比率,然后記錄到一個文件中,在系統重啟后為系統做出最佳時間補償調整。
# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift

# 如果系統時鐘的偏移量大于1秒,則允許系統時鐘在前三次更新中步進。
# Allow the system clock to be stepped in the first three updates if its offset is larger than 1 second.
makestep 1.0 3

# 啟用實時時鐘(RTC)的內核同步。
# Enable kernel synchronization of the real-time clock (RTC).
rtcsync

# 通過使用 hwtimestamp 指令啟用硬件時間戳
# 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

# 改動2
# 指定 NTP 客戶端地址或網段,以允許或拒絕連接到扮演時鐘服務器的機器
# Allow NTP client access from local network.
allow 120.10.10.0/24

# Serve time even if not synchronized to a time source.
#local stratum 10

# 指定包含 NTP 身份驗證密鑰的文件。
# Specify file containing keys for NTP authentication.
#keyfile /etc/chrony.keys

# 指定日志文件的目錄。
# Specify directory for log files.
logdir /var/log/chrony

# 選擇日志文件要記錄的信息。
# Select which information is logged.
#log measurements statistics tracking

服務端開啟同步功能:

systemctl enable chronyd
systemctl restart chronyd

# 查看時間同步狀態
timedatectl status
# 開啟網絡時間同步
timedatectl set-ntp true

客戶端配置,也注意兩個改動:

# 使用 pool.ntp.org 項目中的公共服務器。以server開,理論上想添加多少時間服務器都可以。
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
# 改動1
server 120.10.10.10 iburst

# 根據實際時間計算出服務器增減時間的比率,然后記錄到一個文件中,在系統重啟后為系統做出最佳時間補償調整。
# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift

# 如果系統時鐘的偏移量大于1秒,則允許系統時鐘在前三次更新中步進。
# Allow the system clock to be stepped in the first three updates if its offset is larger than 1 second.
makestep 1.0 3

# 啟用實時時鐘(RTC)的內核同步。
# Enable kernel synchronization of the real-time clock (RTC).
rtcsync

# 通過使用 hwtimestamp 指令啟用硬件時間戳
# 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

# 指定 NTP 客戶端地址,以允許或拒絕連接到扮演時鐘服務器的機器
# Allow NTP client access from local network.
# 改動2
allow 120.10.10.10

# Serve time even if not synchronized to a time source.
#local stratum 10

# 指定包含 NTP 身份驗證密鑰的文件。
# Specify file containing keys for NTP authentication.
#keyfile /etc/chrony.keys

# 指定日志文件的目錄。
# Specify directory for log files.
logdir /var/log/chrony

# 選擇日志文件要記錄的信息。
# Select which information is logged.
#log measurements statistics tracking

三、使用

修改時區或日期時間(首先配置):

# 查看日期時間、時區及 NTP 狀態
timedatectl

# 查看時區列表
timedatectl list-timezones
timedatectl list-timezones | ?grep ?-E "Asia/S.*"

# 修改時區
timedatectl set-timezone Asia/Shanghai

# 修改日期時間(可以只修改其中一個)
timedatectl set-time "2019-09-19 15:50:20"

# 開啟 NTP,true表示開啟
timedatectl set-ntp true/flase

# 查看日期時間、時區及 NTP 狀態
timedatectl

# 查看時區列表
timedatectl list-timezones
timedatectl list-timezones | ?grep ?-E "Asia/S.*"

# 修改時區
timedatectl set-timezone Asia/Shanghai

# 修改日期時間(可以只修改其中一個)
timedatectl set-time "2019-09-19 15:50:20"

# 開啟 NTP,true表示開啟
timedatectl set-ntp true/flase

Chronyc命令:

# 查看 ntp_servers
chronyc sources -v

# 查看 ntp_servers 狀態
chronyc sourcestats -v

# 查看 ntp_servers 是否在線
chronyc activity -v

# 查看 ntp 詳細信息
chronyc tracking -v

Linux公共服務組件之時間同步chrony

文章鏈接: http://m.qzkangyuan.com/9980.html

文章標題:Linux公共服務組件之時間同步chrony

文章版權:夢飛科技所發布的內容,部分為原創文章,轉載請注明來源,網絡轉載文章如有侵權請聯系我們!

聲明:本站所有文章,如無特殊說明或標注,均為本站原創發布。任何個人或組織,在未征得本站同意時,禁止復制、盜用、采集、發布本站內容到任何網站、書籍等各類媒體平臺。如若本站內容侵犯了原著者的合法權益,可聯系我們進行處理。

給TA打賞
共{{data.count}}人
人已打賞
建站教程投稿分享

認證協議LDAP

2022-9-13 16:22:43

建站教程投稿分享

Linux公共服務組件之DNS

2022-9-14 12:28:04

0 條回復 A文章作者 M管理員
    暫無討論,說說你的看法吧
?
個人中心
購物車
優惠劵
今日簽到
有新私信 私信列表
搜索
主站蜘蛛池模板: 泾源县| 龙陵县| 英山县| 渭南市| 高淳县| 息烽县| 海城市| 汉寿县| 叙永县| 太白县| 平塘县| 东乡县| 汤原县| 张家港市| 惠东县| 垦利县| 同心县| 延津县| 甘南县| 宝丰县| 兰考县| 英超| 青阳县| 吴堡县| 怀宁县| 开远市| 永康市| 宁南县| 马关县| 嘉荫县| 开江县| 赤城县| 东平县| 荆州市| 缙云县| 临城县| 崇文区| 子洲县| 彩票| 景洪市| 安图县|