电脑知识|欧美黑人一区二区三区|软件|欧美黑人一级爽快片淫片高清|系统|欧美黑人狂野猛交老妇|数据库|服务器|编程开发|网络运营|知识问答|技术教程文章 - 好吧啦网

您的位置:首頁技術文章
文章詳情頁

centos7安裝chronyd服務方式

瀏覽:182日期:2023-10-01 20:59:26
目錄centos7安裝chronyd服務Centos7使用chronyd進行時鐘同步安裝配置文件啟動服務及時區設置驗證服務手動同步時間手動設置時間總結centos7安裝chronyd服務

一、雙節點部署:

ip主機名192.168.100.10controller192.168.100.20compute

二、配置時間同步

1、雙節點安裝chrony服務(這里是使用本地的軟件包進行yum安裝)

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

2、controller修改chrony服務配置文件(在/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 iburstserver 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、雙節點重啟服務,并設置開機自啟

[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、雙節點執行chronyc sources命令,結果中存在以^*開頭的行,則同步成功

[root@controller ~]# chronyc sources210 Number of sources = 1MS Name/IP address Stratum Poll Reach LastRx Last sample ===============================================================================^* controller 10 6 377 27 +186ns[-8404ns] +/- 17us[root@compute ~]# chronyc sources210 Number of sources = 1MS Name/IP address Stratum Poll Reach LastRx Last sample ===============================================================================^* controller 10 6 17 34 -4280ns[ -13us] +/- 328usCentos7使用chronyd進行時鐘同步

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

安裝# 默認已經安裝$ 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).# 國家服務器server 0.cn.pool.ntp.orgserver 1.cn.pool.ntp.orgserver 2.cn.pool.ntp.orgserver 3.cn.pool.ntp.org# 阿里server ntp.aliyun.com# 騰訊server time1.cloud.tencent.comserver time2.cloud.tencent.comserver time3.cloud.tencent.comserver time4.cloud.tencent.comserver 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啟動服務及時區設置# 啟動服務$ systemctl start chronyd# 開機啟動$ systemctl enable chronyd# 查看當前狀態$ systemctl status chronyd# 查看亞洲時區$ timedatectl list-timezones | grep Asia# 設置時區$ timedatectl set-timezone Asia/Shanghai驗證服務# 查看現有的時間服務器$ chronyc sources -v# 查看時間服務器狀態$ chronyc sourcestats -v# 顯示時鐘同步相關參數$ chronyc tracking# 查看當前時區及時間$ 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手動設置時間# date 設置時間$ date -s '2021-06-03 19:00:00'# 關閉 ntp 同步后,才可以使用 timedatectl 進行時間設置$ timedatectl set-ntp false# 設置日期和時間$ timedatectl set-time '2021-06-03 19:00:00'# 設置日期$ timedatectl set-time '2021-06-03'# 設置時間$ timedatectl set-time '19:00:00'# 設置完成后,再開啟$ timedatectl set-ntp true總結

以上為個人經驗,希望能給大家一個參考,也希望大家多多支持好吧啦網。

標簽: Linux
主站蜘蛛池模板: 智能监控-安防监控-监控系统安装-弱电工程公司_成都万全电子 | 一体化净水器_一体化净水设备_一体化水处理设备-江苏旭浩鑫环保科技有限公司 | 临海涌泉蜜桔官网|涌泉蜜桔微商批发代理|涌泉蜜桔供应链|涌泉蜜桔一件代发 | C形臂_动态平板DR_动态平板胃肠机生产厂家制造商-普爱医疗 | 镀锌角钢_槽钢_扁钢_圆钢_方矩管厂家_镀锌花纹板-海邦钢铁(天津)有限公司 | 青岛侦探_青岛侦探事务所_青岛劝退小三_青岛调查出轨取证公司_青岛婚外情取证-青岛探真调查事务所 | 工业制氮机_psa制氮机厂家-宏骁智能装备科技江苏有限公司 | 亮化工程,亮化设计,城市亮化工程,亮化资质合作,长沙亮化照明,杰奥思【官网】 | 千斤顶,液压千斤顶-力良企业,专业的液压千斤顶制造商,shliliang.com | 通风天窗,通风气楼,屋顶通风天窗,屋顶通风天窗公司 | 长江船运_国内海运_内贸船运_大件海运|运输_船舶运输价格_钢材船运_内河运输_风电甲板船_游艇运输_航运货代电话_上海交航船运 | 硅PU球场、篮球场地面施工「水性、环保、弹性」硅PU材料生产厂家-广东中星体育公司 | LINK FASHION 童装·青少年装展| 铣床|万能铣床|立式铣床|数控铣床|山东滕州万友机床有限公司 | 冷却塔改造厂家_不锈钢冷却塔_玻璃钢冷却塔改造维修-广东特菱节能空调设备有限公司 | 【ph计】|在线ph计|工业ph计|ph计厂家|ph计价格|酸度计生产厂家_武汉吉尔德科技有限公司 | 盘式曝气器-微孔曝气器-管式曝气器-曝气盘-斜管填料 | 郑州市前程水处理有限公司 | 布袋式除尘器|木工除尘器|螺旋输送机|斗式提升机|刮板输送机|除尘器配件-泊头市德佳环保设备 | 加气混凝土砌块设备,轻质砖设备,蒸养砖设备,新型墙体设备-河南省杜甫机械制造有限公司 | 自动气象站_气象站监测设备_全自动气象站设备_雨量监测站-山东风途物联网 | 火锅加盟_四川成都火锅店加盟_中国火锅连锁品牌十强_朝天门火锅【官网】 | 聚合氯化铝-碱式氯化铝-聚合硫酸铁-聚氯化铝铁生产厂家多少钱一吨-聚丙烯酰胺价格_河南浩博净水材料有限公司 | 三价铬_环保铬_环保电镀_东莞共盈新材料贸易有限公司 | 工程管道/塑料管材/pvc排水管/ppr给水管/pe双壁波纹管等品牌管材批发厂家-河南洁尔康建材 | 云南成人高考网| 碳化硅,氮化硅,冰晶石,绢云母,氟化铝,白刚玉,棕刚玉,石墨,铝粉,铁粉,金属硅粉,金属铝粉,氧化铝粉,硅微粉,蓝晶石,红柱石,莫来石,粉煤灰,三聚磷酸钠,六偏磷酸钠,硫酸镁-皓泉新材料 | 交变/复合盐雾试验箱-高低温冲击试验箱_安奈设备产品供应杭州/江苏南京/安徽马鞍山合肥等全国各地 | 哲力实业_专注汽车涂料汽车漆研发生产_汽车漆|修补油漆品牌厂家 长沙一级消防工程公司_智能化弱电_机电安装_亮化工程专业施工承包_湖南公共安全工程有限公司 | 焊接烟尘净化器__焊烟除尘设备_打磨工作台_喷漆废气治理设备 -催化燃烧设备 _天津路博蓝天环保科技有限公司 | 成人纸尿裤,成人尿不湿,成人护理垫-山东康舜日用品有限公司 | 皮带式输送机械|链板式输送机|不锈钢输送机|网带输送机械设备——青岛鸿儒机械有限公司 | 制氮设备_PSA制氮机_激光切割制氮机_氮气机生产厂家-苏州西斯气体设备有限公司 | PU树脂_水性聚氨酯树脂_聚氨酯固化剂_聚氨酯树脂厂家_宝景化工 | 无线联网门锁|校园联网门锁|学校智能门锁|公租房智能门锁|保障房管理系统-KEENZY中科易安 | 湖南长沙商标注册专利申请,长沙公司注册代理记账首选美创! | 神马影院-实时更新秒播 | 东莞螺丝|东莞螺丝厂|东莞不锈钢螺丝|东莞组合螺丝|东莞精密螺丝厂家-东莞利浩五金专业紧固件厂家 | 浙江上沪阀门有限公司| 电子海图系统-电梯检验系统-智慧供热系统开发-商品房预售资金监管系统 | 昊宇水工|河北昊宇水工机械工程有限公司 | 南溪在线-南溪招聘找工作、找房子、找对象,南溪综合生活信息门户! |