最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

centos7安裝chronyd服務(wù)方式

 更新時間:2023年06月02日 09:45:17   作者:奈小奈  
這篇文章主要介紹了centos7安裝chronyd服務(wù)方式,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教

centos7安裝chronyd服務(wù)

一、雙節(jié)點部署:

ip主機(jī)名
192.168.100.10controller
192.168.100.20compute

二、配置時間同步

1、雙節(jié)點安裝chrony服務(wù)(這里是使用本地的軟件包進(jìn)行yum安裝)

[root@controller ~]# yum install -y chrony
[root@compute ~]# yum install -y chrony

2、controller修改chrony服務(wù)配置文件(在/etc/chrony.conf目錄下)

[root@controller ~]# vi /etc/chrony.conf 
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.centos.pool.ntp.org iburst          //添加#號
#server 1.centos.pool.ntp.org iburst          //添加#號
#server 2.centos.pool.ntp.org iburst          //添加#號
#server 3.centos.pool.ntp.org iburst          //添加#號
server controller 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 all                              //去掉#號
# Serve time even if not synchronized to a time source.
local stratum 10                       //去掉#號
# 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

3、compute 修改chrony配置文件

[root@compute ~]# vi /etc/chrony.conf 
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server 192.168.100.10 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
# Specify directory for log files.
logdir /var/log/chrony
# Select which information is logged.
#log measurements statistics tracking

4、雙節(jié)點重啟服務(wù),并設(shè)置開機(jī)自啟

[root@controller ~]# systemctl restart chronyd && systemctl enable chronyd
[root@compute ~]# systemctl restart chronyd && systemctl enable chronyd

5、controller開啟ntp同步

[root@controller ~]# timedatectl set-ntp true

6、雙節(jié)點執(zhí)行chronyc sources命令,結(jié)果中存在以^*開頭的行,則同步成功

[root@controller ~]# chronyc sources
210 Number of sources = 1
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^* controller                   10   6   377    27   +186ns[-8404ns] +/-   17us
[root@compute ~]# chronyc sources
210 Number of sources = 1
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^* controller                   10   6    17    34  -4280ns[  -13us] +/-  328us

Centos7使用chronyd進(jìn)行時鐘同步

最近要做阿里云遷移 IDC 機(jī)房,整理下 Linux 運(yùn)維基線,簡單記錄,以備后用~

安裝

# 默認(rèn)已經(jīng)安裝
$ yum install -y chrony

配置文件

$ cat /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
# 國家服務(wù)器
server 0.cn.pool.ntp.org
server 1.cn.pool.ntp.org
server 2.cn.pool.ntp.org
server 3.cn.pool.ntp.org
# 阿里
server ntp.aliyun.com
# 騰訊
server time1.cloud.tencent.com
server time2.cloud.tencent.com
server time3.cloud.tencent.com
server time4.cloud.tencent.com
server time5.cloud.tencent.com
# 蘋果
server time.asia.apple.com
# 微軟
server time.windows.com
# 其他
server cn.ntp.org.cn
# 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
# Specify directory for log files.
logdir /var/log/chrony
# Select which information is logged.
#log measurements statistics tracking

啟動服務(wù)及時區(qū)設(shè)置

# 啟動服務(wù)
$ systemctl start chronyd
# 開機(jī)啟動
$ systemctl enable chronyd
# 查看當(dāng)前狀態(tài)
$ systemctl status chronyd
# 查看亞洲時區(qū)
$ timedatectl list-timezones | grep Asia
# 設(shè)置時區(qū)
$ timedatectl set-timezone Asia/Shanghai

驗證服務(wù)

# 查看現(xiàn)有的時間服務(wù)器
$ chronyc sources -v
# 查看時間服務(wù)器狀態(tài)
$ chronyc sourcestats -v
# 顯示時鐘同步相關(guān)參數(shù)
$ chronyc tracking
# 查看當(dāng)前時區(qū)及時間
$ timedatectl?

手動同步時間

# 使用 ntpdate 同步時間
$ ntpdate ntp.aliyun.com
# chronyd 未啟動時,如下命令同步時間
$ chronyd -q 'server pool.ntp.org iburst'
# chronyd 啟動時,使用如下命令同步時間
$ chronyc -a 'burst 4/4' && sleep 10 && chronyc -a makestep

手動設(shè)置時間

# date 設(shè)置時間
$ date -s '2021-06-03 19:00:00'
# 關(guān)閉 ntp 同步后,才可以使用 timedatectl 進(jìn)行時間設(shè)置
$ timedatectl set-ntp false
# 設(shè)置日期和時間
$ timedatectl set-time '2021-06-03 19:00:00'
# 設(shè)置日期
$ timedatectl set-time '2021-06-03'
# 設(shè)置時間
$ timedatectl set-time '19:00:00'
# 設(shè)置完成后,再開啟
$ timedatectl set-ntp true

總結(jié)

以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

岗巴县| 广安市| 霍林郭勒市| 榆林市| 迁西县| 泊头市| 商都县| 广水市| 兴山县| 射洪县| 那曲县| 浦北县| 邵东县| 武平县| 阿拉善右旗| 清流县| 张家川| 周口市| 宝山区| 前郭尔| 井陉县| 普格县| 汤阴县| 阿拉善右旗| 乡宁县| 合阳县| 新昌县| 治多县| 江津市| 阿拉善右旗| 丹东市| 钦州市| 东乌| 巴青县| 缙云县| 建水县| 铜山县| 姚安县| 闻喜县| 成武县| 静安区|