chrony 时间同步
RHEL7.4 192.168.100.1 作为时间服务器,其它主机到这台来同步时间。
时间服务器安装及配置:
#yum install chrony --RHEL7默认已安装chrony,而没有安装ntpd.
#systemctl status chronyd --查看chronyd服务状态
#systemctl enable chronyd --开机启动
#vi /etc/chrony.conf --修改配置文件
|
#server 0.rhel.pool.ntp.org iburst --注释这4行,由于是内网环境,所以无法跟外部时间服务器进行时间同步。 # Allow NTP client access from local network. |
#systemctl restart chronyd --修改完配置文件后,重启chronyd服务
|
[root@rhel1 ~]# netstat -antulp | grep chronyd |
1.显示系统的当前时间和日期
timedatectl
# timedatectl status
# 两条命令效果等同
|
[root@rhel1 ~]# timedatectl |
注意NTP synchronized值,只有时间服务器自己同步完成时间之后,才能为其它服务器提供时间同步服务。
2.设置日期与时间
timedatectl set-time "YYYY-MM-DD HH:MM:SS"
timedatectl set-time "YYYY-MM-DD"
timedatectl set-time "HH:MM:SS"
3.查看所有可用的时区
timedatectl list-timezones
# 亚洲
timedatectl list-timezones | grep -E "Asia/S.*"
4.设置时区
timedatectl set-timezone Asia/Shanghai
5.设置硬件时间
# 硬件时间默认为UTC
timedatectl set-local-rtc 1
# hwclock --systohc --localtime
# 两条命令效果等同
6.启用NTP时间同步
timedatectl set-ntp yes
# yes或no; 1或0也可以
问题:不明白这里启用ntp时间同步有啥意义。难道是说可以在时间服务器上都安装chronyd和ntpd服务来同时提供时间服务吗????如果设置为yes,手动设置时间则报错。看本文结尾。
7、查看时间源信息
|
[root@rhel1 ~]# chronyc sources .-- Source mode '^' = server, '=' = peer, '#' = local clock. |
客户端时间同步配置:
1.yum install chrony –y
2.修改配置文件
|
[root@rhel2 ~]# vi /etc/chrony.conf |
3.重启chronyd并设置开机启动
[root@rhel2 ~]# systemctl restart chronyd.service
[root@rhel2 ~]# systemctl enable chronyd.service
4. 查看时间同步状态
|
[root@rhel2 ~]# timedatectl |
重启chronyd服务后,需要过几分钟才会自动完成同步。
如果需要手动,可使用下面的命令:
#ntpdate 192.168.100.1 如果同步失败,则可能 是服务端的时间未同步。即服务端NTP synchronized 为no。
============================
手动修改时间时,必须把NTP enabled 设置为no.
|
[root@rhel1 ~]# date |
如果把NTP enabled 修改为yes时,表示开启自动同步时间,此时,是不能手动修改时间的。
如果为No时,表示关闭自动同步时间。
[root@rhel1 ~]# timedatectl set-ntp yes
[root@rhel1 ~]# timedatectl set-time "2017-10-08 11:00:50"
Failed to set time: Automatic time synchronization is enabled
[root@rhel1 ~]# timedatectl set-ntp no
[root@rhel1 ~]# timedatectl set-time "2017-10-08 11:00:50"
[root@rhel1 ~]# date
Sun Oct 8 11:00:51 CST 2017
chrony 时间同步的更多相关文章
- chrony时间同步 服务端 客户端 安装配置
chrony时间同步 服务端 客户端 安装配置 原创内容http://www.cnblogs.com/elvi/p/7658021.html #!/bin/sh #运行环境 centos7 #chro ...
- CentOS7.4 chrony时间同步服务器部署(替代NTPD)
Chrony是一个开源的自由软件,它能保持系统时钟与时钟服务器(NTP)同步,让时间保持精确. 它由两个程序组成:chronyd和chronyc. chronyd是一个后台运行的守护进程,用于调整内核 ...
- Linux基础学习-chrony时间同步服务
Chrony时间同步 NTP(Network Time Protocol,网络时间协议)是用来使网络中的各个计算机时间同步的一种协议.它的用于是把计算机的时钟同步到世界协调时UTC,其精度在局域网内可 ...
- Linux 时间同步 05 chrony时间同步
Linux 时间同步 05 chrony时间同步 目录 Linux 时间同步 05 chrony时间同步 chrony 的优势: chrony包介绍 安装chrony 配置与外部时间服务器进行时间同步 ...
- linux服务之NTP及chrony时间同步
博客园 首页 联系 管理 linux服务之NTP及chrony时间同步 一.NTP时间同步 NTP(Network Time Protocol,网络时间协议)是由RFC 1305定义的时间同步 ...
- Chrony时间同步服务
概: 网络时间协议(Network Time Protocol,NTP)是用于网络时间同步的协议.提供NTP时间同步服务的软件有很多,这里采用Chrony软件来实现时间同步 chrony 的优势: ...
- chrony 时间同步服务器
这篇文章也不错: https://www.zfl9.com/chrony.html 简介 chrony是网络时间协议(NTP)的多用途实现.它可以使系统时钟与NTP服务器.参考时钟(例如GPS接收器) ...
- centos 8.x系统配置chrony时间同步服务
redhat/centos 7.x默认使用的时间同步服务为ntp服务,但是从redhat/centos 8开始在官方的仓库中移除了ntp软件,换成默认的chrony进行时间同步的服务,虽然也可以通过添 ...
- Chrony时间同步
chrony 服务器 yum -y install chrony cp /etc/chrony.conf{,.bak} #备份默认配置 cat > /etc/chrony.conf <&l ...
随机推荐
- Jackson 教程演示样例
查看原文教程:http://www.ibloger.net/article/275.html Json经常使用的类库例如以下 Jackson:http://jackson.codehaus.org/ ...
- Chart/Report资源目录
ylbtech-Chart:Chart/Report资源目录 1.Chart.js返回顶部 1-0.官网 http://www.chartjs.org 1-1.实例 http://www.chartj ...
- sgd学习率选择问题
关于使用SGD时如何选择初始的学习率(这里SGD是指带动量的SGD,momentum=0.9): 训练一个epoch,把学习率从一个较小的值(10-8)上升到一个较大的值(10),画出学习率(取log ...
- 免费桌面视频录像工具OBS的简单操作介绍
本帖最后由 felix0911 于 2014-5-21 09:32 编辑 0起点,傻瓜操作,为什么不尝试录制一个自己的游戏视频,来展现自己牛逼风骚的操作呢?(本教学不包括后期制作,特效背景音乐等部分) ...
- Tensorflow LSTM实现
Tensorflow[LSTM] 0.背景 通过对<tensorflow machine learning cookbook>第9章第3节"implementing_lstm ...
- linux命令学习——ps
1.命令简介 ps命令用来查看系统上的进程信息.要对进程进行监测和控制,首先必须要了解当前进程的情况,也就是需要查看当前进程,而 ps 命令就是最基本同时也是非常强大的进程查看命令.使用该命令可以确定 ...
- FPS游戏服务器设计的问题 【转】
一.追溯 去gameloft笔试,有一个题目是说: 叫你去设计一个FPS(第一人称射击游戏),你是要用TCP呢还是要用UDP,说明理由 . 二.学习 这是两篇网上找到的文章,写非常不错. 当时笔试的时 ...
- innerWidth outerWidth
在jQuery中: 一.width()方法用于获得元素宽度: 二.innerWidth()方法用于获得包括内边界(padding)的元素宽度; 三.outerWidth()方法用于获得包括内边界(pa ...
- [海蜘蛛] 海蜘蛛 V8 全线无限试用版 免费发布破解教程
http://bbs.p52.cn/forum.php?mod=viewthread&tid=3499&extra=page%3D1&page=1&_dsign=79c ...
- Active Directory 域服务(AD DS)
本文内容 概述 工作组架构与域架构 名称空间(Namespace) 对象(Object).容器(Container)与组织单位(Organization Units,OU) 域树(Domain Tre ...