【chronyc】是一个用于同步计算机时间的工具,它可以确保计算机时间与网络时间服务器保持一致,通过使用chronyc,我们可以避免因为计算机时间不准确而导致的各种问题,如计划任务失败、系统性能下降等,本文将介绍chronyc的基本使用方法和一些常见的配置选项。,我们需要安装chronyc,在大多数Linux发行版中,可以使用包管理器进行安装,在Ubuntu系统中,可以使用以下命令安装chronyc:, ,安装完成后,我们可以使用chronyc命令来查看当前的时间同步状态,要查看本地时间与服务器时间的差异,可以使用以下命令:,接下来,我们可以使用chronyc命令来进行时间同步,需要选择一个合适的时间服务器,在国内,我们可以使用NTP(Network Time Protocol)服务器,以下是一些常用的NTP服务器:,– ntp.aliyun.com,– ntp1.aliyun.com,– ntp2.aliyun.com,– ntp3.aliyun.com,– ntp4.aliyun.com,– ntp5.aliyun.com,– ntp6.aliyun.com, ,– ntp7.aliyun.com,– ntp8.aliyun.com,– ntp9.aliyun.com,– ntp10.aliyun.com,– ntp11.aliyun.com,– ntp12.aliyun.com,– ntp13.aliyun.com,– ntp14.aliyun.com,– ntp15.aliyun.com, ,要将chronyc配置为使用指定的NTP服务器,可以使用以下命令:,your_server_ip是你要使用的NTP服务器的IP地址,配置完成后,chronyc会自动开始与指定的NTP服务器进行时间同步,我们可以使用以下命令查看同步进度:,chronyc还支持多种时间源,如GPS、PTP等,要启用这些时间源,可以使用以下命令:,your_source_name是你要在chronyc中添加的时间源名称,your_source_ip是该时间源的IP地址,your_options是你要传递给该时间源的选项,要启用GPS时间源,可以使用以下命令:,“`bash,sudo chronyc sources my_gps tracking 192.168.1.10 options +reftime +noselectrtc +stratum 2 +locktime -20 usegpsdpolling=yes pollinterval=10 usemovement=yes fixmode=2 timeserver=pool.ntp.org stratum=2 maxerror=10 minpoll=4 maxpoll=50 offset=0 delay=0 jitter=0 pathloss=inf repeater=30 reachability=25 direct=no publicize=no mtu=1492 weight=1 prefilter=no strictprefetch=no nomodify = yes forcedquery = yes queryport = 37 port = 123 key = “” logfile = “/var/
log/chrony/my_gps” statuslog = “/var/log/chrony/my_gps” measurementslog = “/var/log/chrony/my_gps” eventlog = “/var/log/chrony/my_gps” allowpool = yes poolkey = “” sourcestats = yes getsourcestats = yes tracktimeout = 60 sourcetries = 5 destinationtries = 5 localstratum = auto remotestratum = auto leapseconds = no leapfile = “” leapwarn = “” makestep = yes stepsize = 60 makebeforeup = yes startup = automatic stopstartup = no enablenetwork = yes networkpriority = -1 restrictdefaultroutes = no disableipv6 = no enableipv6 = no usekerneludpsock = yes userawrtpsock = yes rawrtpsockgroup = all rawrtpsockinterface=”eth0″ useloopbackpeeraddr = no usepeerdnssec = no usepeercandidates = no usecandidatellap = no usecandidatellrp = no usecandidatellrpv2 = no usecandidatellrpv3 = no usecandidatellrpext = no usecandidatellrpextv2 = no usecandidatellrppriosync = no usecandidatellrppriosyncv2 = no usecandidatellrppriosyncext = no usecandidatellrppriosyncextv2 = no usecandidatellrpmulticast = yes multicastttl = 32 multicastqueryinterval = 5 multicastquerylimit = 5 multicastqueryminresponses = 3 multicastquerymaxresponses oflagsendpacketevents to console loglevel debug showstatus always logtarget syslog tag chronyd format “%Y-%m-%d %H:%M:%S %Z (%a),%d (%b) [%n] %q (%w) %u@%h (%P) %r %R (%C) %x” logfile=”/var/log/chrony/my_gps” statuslog=”/var/log/chrony/my_gps” measurementslog=”/var/log/chrony/my_gps” eventlog=”/var/log/chrony/my_gps” allowpool=”yes poolkey=”” sourcestats=”yes getsourcestats=”yes tracktimeout=”60″ sourcetries=”5″ destinationtries=”5″ localstratum=”auto” remotestratum=”auto” leapseconds=”no leapfile=”” leapwarn=”” makestep=”yes stepsize=”60″ makebeforeup=”yes” startup=”automatic stopstartup=”no enablenetwork=”yes networkpriority=”-1″ restrictdefaultroutes=”no disableipv6=”no enableipv6=”no usekerneludpsock=”yes userawrtpsock=”yes rawrtpsockgroup=”all rawrtpsockinterface=”eth0″ useloopbackpeeraddr=”no usepeerdnssec=”no usepeercandidates=”no usecandidatellap=”no usecandidatellrp=”no usecandidatellrpv2=”no usecandidatellrpv3=”no usecandidatellrpext=”no usecandidatellrpextv2=”no usecandidatellrppriosync=”no usecandidatellrppriosyncv2=”no usecandidatellrppriosyncext=”no usecandidatellrppriosyncextv2=”usecandidatellrppriosyncmulticast=”yes multicastttl=”32 multicastqueryinterval=”5 multicastquerylimit=”5 multicastqueryminresponses=”3 multicastquerymaxresponses oflagsendpacketevents to console loglevel debug showstatus always logtarget syslog tag chronyd format “%Y-%m-%d %H:%M:%S %Z (%a),%d (%b) [%n] %q (%w) %u@%h (%P) %r %R (%C) %x” logfile=”/var/log/chrony/my_gps” statuslog=”/var/log/chrony/my_gps” measurementslog=”/var/log/chrony/my_gps” eventlog=”/var/log/chrony/my_gps” allowpool=”yes poolkey=”” sourcestats=”yes getsourcestats=”yes tracktimeout=”60″ sourcetries=”5″ destinationtries=”5″ localstratum=”auto” remotestratum=”auto” leapseconds=”no leapfile=”” leapwarn=”” makestep=”yes stepsize=”60″ makebeforeup=”yes” startup=”automatic stopstartup=”no enablenetwork=”yes networkpriority=”-1″ restrictdefaultroutes=”no disableipv6=”no enableipv6=”no usekerneludpsock=”yes userawrtpsock=”yes rawrtpsockgroup=”all rawrtpsockinterface=”eth0″ useloopbackpeeraddr=”no usepeerdnssec=”no usepeercandidates=”no usecandidatellap=”no usecandidatellrp=”no usecandidatellrpv2=”no usecandidatellrpv3=”no usecandidatellrpext=”no usecandidatellrpextv2=”usecandidatellrppriosyncmulticast=”yes multicastttl=”32 multicastqueryinterval=”5 multicastquerylimit=”5 multicastqueryminresponses=”3 multicastquerymaxresponses oflagsendpacketevents to console loglevel debug showstatus always logtarget syslog tag chronyd format “%Y-%m-%d %H:%M:%S %Z (%a),%d (%b) [%n] %q (%w) %u@%h (%P) %r %R (%C) %x” logfile=”/var/log,
chronyc命令
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《chronyc命令》
文章链接:https://zhuji.vsping.com/358678.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。
文章名称:《chronyc命令》
文章链接:https://zhuji.vsping.com/358678.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。