九色91_成人精品一区二区三区中文字幕_国产精品久久久久一区二区三区_欧美精品久久_国产精品99久久久久久久vr_www.国产视频

Hello! 歡迎來到小浪云!


云服務(wù)器centos7時(shí)間同步——NTP



NTP同步方式在Linux下一般兩種:使用ntpdate命令直接同步和使用NTPD服務(wù)平滑同步。

使用ntpdate命令直接同步的方式存在風(fēng)險(xiǎn),比如一些定時(shí)任務(wù)在已有時(shí)間內(nèi)執(zhí)行過,直接同步導(dǎo)致時(shí)間變回任務(wù)執(zhí)行前的時(shí)間段,定時(shí)任務(wù)會(huì)重復(fù)執(zhí)行。

使用NTPD服務(wù)平滑同步的方式不會(huì)讓一個(gè)時(shí)間點(diǎn)在一天內(nèi)經(jīng)歷兩次,而是平滑同步時(shí)間,它每次同步時(shí)間的偏移量不會(huì)太陡,是慢慢來的。

查看是否安裝NTP包

rpm -qa |grep ntp

如果有輸出ntp和ntpdate版本信息,即已安裝。

ntp 可用systemctl管理

# 查看服務(wù)狀態(tài)service ntpd status# 啟動(dòng)ntpd服務(wù)systemctl start ntpd.service# 停止ntpd服務(wù)systemctl stop ntpd.service# 設(shè)置開機(jī)自啟動(dòng)systemctl enable ntpd.service# 停止開機(jī)自啟動(dòng)systemctl disable ntpd.service# 查看服務(wù)當(dāng)前狀態(tài)systemctl status ntpd.service# 重新啟動(dòng)服務(wù)systemctl restart ntpd.service# 查看所有已啟動(dòng)的服務(wù)systemctl list-units –type=service

作為ntp客戶端,如何同步服務(wù)器端的時(shí)間?

以公用的一些時(shí)間同步服務(wù)器為例

systemctl stop ntpd # 使用ntpdate同步前需要關(guān)閉ntpd服務(wù),不然會(huì)失敗ntpdate cn.pool.ntp.orgsystemctl enable ntpd.servicesystemctl start ntpd.service# cn.pool.ntp.org 中國開源免費(fèi)NTP服務(wù)器# ntp1.aliyun.com 阿里云NTP服務(wù)器# ntp2.aliyun.com 阿里云NTP服務(wù)器# time1.aliyun.com 阿里云NTP服務(wù)器# time2.aliyun.com 阿里云NTP服務(wù)器

如何配置服務(wù)器作為內(nèi)網(wǎng)內(nèi)的時(shí)間同步服務(wù)器?(NTP服務(wù)器的配置)

配置內(nèi)網(wǎng)NTP-Server(10.0.0.12)

配置NTPD服務(wù)的服務(wù)器需要能訪問外網(wǎng),這里挑選了一臺(tái)可以訪問外網(wǎng)的Linux服務(wù)器配置內(nèi)網(wǎng)的NTPD服務(wù),作為NTP-Server,其他幾臺(tái)內(nèi)網(wǎng)通過它來進(jìn)行時(shí)間同步。

這里假設(shè)其IP為10.0.0.12,其他幾臺(tái)內(nèi)網(wǎng)的服務(wù)器IP分別為10.0.0.13、10.0.0.14。

在配置NTPD服務(wù)之前,先手動(dòng)同步一下時(shí)間

systemctl stop ntpd # 使用ntpdate同步前需要關(guān)閉ntpd服務(wù),不然會(huì)失敗ntpdate cn.pool.ntp.orgsystemctl enable ntpd.servicesystemctl start ntpd.service

修改NTPD服務(wù)的配置文件/etc/ntp.conf

[root@localhost ~]vim /etc/ntp.conf#和上層NTP服務(wù)器頻率誤差的記錄文件driftfile /var/lib/ntp/drift#對于默認(rèn)的client拒絕所有操作,下面的restrict開通指定權(quán)限restrict default nomodify notrap nopeer noquery#允許本機(jī)地址的一切操作restrict 127.0.0.1restrict ::1#允許192.168.203段機(jī)器同步時(shí)間,指定可以和NTP通信的IP或者網(wǎng)段restrict 192.168.203.0 mask 255.255.255.0 nomodify notrap#遠(yuǎn)程的同步時(shí)間服務(wù)器地址(需要同步外網(wǎng)時(shí)間必改)#prefer表示優(yōu)先同步的主機(jī)server cn.pool.ntp.org preferserver ntp1.aliyun.com iburstserver ntp2.aliyun.com iburstserver ntp3.aliyun.com iburstserver ntp4.aliyun.com iburstserver ntp5.aliyun.com iburst#遠(yuǎn)程時(shí)間服務(wù)器不可用時(shí),以本地時(shí)間作為服務(wù)時(shí)間server 127.127.1.0#stratum指定層數(shù),越小,離時(shí)間源,越近。 層級(jí)1為國際時(shí)間源服務(wù)器fudge 127.127.1.0 stratum 10#允許上層服務(wù)器主動(dòng)修改本機(jī)時(shí)間(需要同步外網(wǎng)時(shí)間必改)restrict cn.pool.ntp.org nomodify notrap noqueryrestrict ntp1.aliyun.com iburst nomodify notrap noqueryrestrict ntp2.aliyun.com iburst nomodify notrap noqueryrestrict ntp3.aliyun.com iburst nomodify notrap noqueryrestrict ntp4.aliyun.com iburst nomodify notrap noqueryrestrict ntp5.aliyun.com iburst nomodify notrap noqueryincludefile /etc/ntp/crypto/pw#指定日志文件logfile /var/log/ntp#指定日志級(jí)別,info、all、event三種可以選擇logconfig all#啟用公鑰加密#crypto#密鑰文件keys /etc/ntp/keys

設(shè)置ntp client客戶端配置文件

vim /etc/ntp.confserver 10.0.0.12

重啟ntp服務(wù)

[root@localhost /]# systemctl stop firewalld[root@localhost /]# setenforce 0[root@localhost /]# vim /etc/seLinux/configSELinux=disabled[root@localhost /]# systemctl restart ntpd

查看ntp服務(wù)同步狀況

ntpd -q

相關(guān)閱讀

主站蜘蛛池模板: 午夜精品久久 | 一级黄色毛片免费 | 国产探花在线精品一区二区 | 91久久久久 | 一区二区三区日 | 精品在线免费观看视频 | 国产精品久久久久久久久久久久 | 欧美日韩淫片 | 国产一区二区三区色淫影院 | 久久久久久久一区二区三区 | 爱爱免费视频网站 | 日日操日日干 | 自拍偷拍视频网 | 亚洲精品一区中文字幕 | 91视频大全 | 在线不卡视频 | 特黄色一级毛片 | 91麻豆精品国产91久久久更新资源速度超快 | 日韩无 | 亚洲综合日韩精品欧美综合区 | 国产精品一区二区三区99 | 亚洲欧美日韩精品久久亚洲区 | 国产精品久久在线 | 久久毛片网站 | 91啪亚洲精品 | 夜夜骑av| 日本精品国产 | 欧美综合精品 | 亚洲国产成人精品女人久久久 | 日韩福利在线 | 欧美日韩在线成人 | 99久久久无码国产精品 | xxxxx免费视频| 国产羞羞视频在线观看 | 91精品国产欧美一区二区成人 | 日本三级全黄三级三级三级口周 | 欧美αv| 国产精品久久久久久吹潮 | 日本久久精品 | 亚洲成人av | 天堂中文在线播放 |