时间同步软件chrony安装配置

1.1.1 chrony服务搭建

1.1.1.1 基本环境

主机名

系统版本

IP地址

角色

chrony-server

CentOS7.4

172.16.1.62

chrony服务端

chrony-client

CentOS7.4

172.16.1.31

chrony客户端

1.1.1.2 服务端配置

# yum -y install chrony

# vim /etc/chrony.conf 

3 #server 0.centos.pool.ntp.org iburst

4 #server 1.centos.pool.ntp.org iburst

5 #server 2.centos.pool.ntp.org iburst

6 #server 3.centos.pool.ntp.org iburst

7 server ntp1.aliyun.com

8 server 210.72.145.44

9 server 202.112.10.36

10 server 59.124.196.83

26 #allow 192.168.0.0/16                                                                   

27 allow 172.16.1.0/24

# systemctl start chronyd    #启动chronyd服务,需要等待5分钟左右才能正常同步

# systemctl enable chronyd  #加入开机自启动

# chronyc sources -v       #查看使用了哪个时间服务器同步,星号的为正在同步的时间服务器

image.png

# chronyc sourcestats -v  #查看同步状态

image.png

1.1.1.3 客户端配置

# yum -y install chrony

# vim /etc/chrony.conf

3 #server 0.centos.pool.ntp.org iburst

4 #server 1.centos.pool.ntp.org iburst

5 #server 2.centos.pool.ntp.org iburst

6 #server 3.centos.pool.ntp.org iburst

7 server 172.16.1.62

# systemctl start chronyd

# systemctl enable chronyd

# chronyc sources

image.png

# chronyc sourcestats -v  #查看同步状态

image.png

1.1.2 有关时间的相关命令

# timedatectl set-timezone Asia/Shanghai    #设置时区

1.1.3 时区概念

1UTC  整个地球分为二十四时区,每个时区都有自己的本地时间。在国际无线电通信场合,为了统一起见,使用一个统一的时间,称为通用协调时(UTC, Universal Time Coordinated)

2GMT  格林威治标准时间 (Greenwich Mean Time)指位于英国伦敦郊区的皇家格林尼治天文台的标准时间,因为本初子午线被定义在通过那里的经线。(UTCGMT时间基本相同,本文中不做区分)

3CST  中国标准时间 (China Standard Time)
GMT + 8 = UTC + 8 = CST

4DST夏令时(Daylight Saving Time) 指在夏天太阳升起的比较早时,将时间拨快一小时,以提早日光的使用。(中国不使用)


猜你喜欢

转载自blog.51cto.com/wn2100/2120641
今日推荐