首页 > 其他 > 详细

十单元补充:时间同步

时间:2016-10-27 01:48:41      阅读:320      评论:0      收藏:0      [点我收藏+]

#####4.如何同步系统时间######

1.服务端
yum install chrony -y   ##安装服务
vim /etc/chrony.conf       ##主配置文件
 22 # Allow NTP client access from local network.
 23 allow 192.168/16    ##允许谁去同步我的时间

 29 # Serve time even if not synchronized to any NTP server.
 30 local stratum 10    ##不去同步任何人的时间,时间同步服务器级别

system restart chronyd
systemctl stop firewalld

2.客户端
vim /etc/chrony.conf
  3 #server 0.rhel.pool.ntp.org iburst
  4 #server 1.rhel.pool.ntp.org iburst====>server ntpserverip iburst
  5 #server 2.rhel.pool.ntp.org iburst====>
  6 #server 3.rhel.pool.ntp.org iburst

systemctl restart chronyd

测试:
[root@foundation50 ~]# chronyc sources -v
210 Number of sources = 1

  .-- Source mode  ‘^‘ = server, ‘=‘ = peer, ‘#‘ = local clock.
 / .- Source state ‘*‘ = current synced, ‘+‘ = combined , ‘-‘ = not combined,
| /   ‘?‘ = unreachable, ‘x‘ = time may be in error, ‘~‘ = time too variable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||                                                /   xxxx = adjusted offset,
||         Log2(Polling interval) -.             |    yyyy = measured offset,
||                                  \            |    zzzz = estimated error.
||                                   |           |                         
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^? bogon                         0  10     0   10y     +0ns[   +0ns] +/-    0ns

###5.timedatectl命令###
timedatectl              status             ##显示当前时间信息
                            set-time HH:mm:ss ##设定当前时间
                         set-timezone       ##设定当前时区
                         set-local-rtc 0|1  ##设定是否使用utc时间
                            

本文出自 “12100661” 博客,谢绝转载!

十单元补充:时间同步

原文:http://12110661.blog.51cto.com/12100661/1866056

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!