chrony实现局域网时间同步
chrony基于cs架构实现,配置一台服务主机与其他客户主机即可
服务端
#yum install chrony --RHEL7默认已安装chrony,而没有安装ntpd. #systemctl status chronyd --查看chronyd服务状态
#systemctl enable chronyd --开机启动 #vi /etc/chrony.conf --修改配置文件 #server .rhel.pool.ntp.org iburst --注释这4行,由于是内网环境,所以无法跟外部时间服务器进行时间同步。
#server .rhel.pool.ntp.org iburst
#server .rhel.pool.ntp.org iburst
#server .rhel.pool.ntp.org iburst
server 192.168.100.1 iburst --添加这一行,表示与本机同步时间 # Allow NTP client access from local network.
allow 192.168.100.0/ --允许哪些服务器到这台服务器来同步时间
客户端
#server .rhel.pool.ntp.org iburst --注释这4行
#server .rhel.pool.ntp.org iburst
#server .rhel.pool.ntp.org iburst
#server .rhel.pool.ntp.org iburst
server 192.168.100.1 iburst ---添加该行,表示到这台服务器去同步时间。
重启chrony服务,并开机自启
[root@rhel2 ~]# systemctl restart chronyd.service
[root@rhel2 ~]# systemctl enable chronyd.service
其他
查看时间同步
[root@rhel2 ~]# timedatectl
Local time: Sat -- :: CST
Universal time: Sat -- :: UTC
RTC time: Sat -- ::
Time zone: Asia/Shanghai (CST, +)
NTP enabled: no
NTP synchronized: yes --为yes表示已同步
RTC in local TZ: no
DST active: n/a
手动修改时间时,必须把NTP enabled 设置为no.
[root@rhel1 ~]# date
Sun Oct :: CST
[root@rhel1 ~]# timedatectl
Local time: Sat -- :: CST
Universal time: Sat -- :: UTC
RTC time: Sun -- ::
Time zone: Asia/Shanghai (CST, +)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
如果把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 :: CST
chrony实现局域网时间同步的更多相关文章
- SUSE Linux实现局域网时间同步
0.前言 需求是这么来的,搭建了Storm集群进行协同过滤算法的计算性能测试,要求精度在毫秒(ms)级别.局域网内40个虚拟机节点,用 date 命令,精度上和效率上都不可行.所以,就搭建了 ...
- 用chrony代替ntpd时间同步服务器
Chrony是一个开源的自由软件,它能保持系统时钟与时钟服务器(NTP)同步,让时间保持精确. 它由两个程序组成:chronyd和chronyc. chronyd是一个后台运行的守护进程,用于调整内核 ...
- CentOS 7配置Chrony服务进行时间同步
CentOS 7版本中使用Chrony工具实现本地时间与标准时间同步.与CentOS 6版本中的NTP服务不同,Chrony可以更快更准确地同步系统时钟,最大程度的减少时间和频率误差.Chrony包含 ...
- C# Winform小程序:局域网设置NTP服务器、实现时间同步
设置NTP服务器: NTP是网络时间协议(Network Time Protocol),它是用来同步网络中各个计算机的时间的协议. 局域网不能连接Internet,可以设置一台计算机为NTP服务器. ...
- CentOS7搭建时间服务器-chrony(不坑)
标签(linux): chrony 笔者Q:972581034 交流群:605799367.有任何疑问可与笔者或加群交流 之前centos6我们一直用的ntp时间服务器,虽然到CentOS7上也可以装 ...
- CentOS 7.X 搭建时间服务器 --- chrony
之前centos6我们一直用的ntp时间服务器,虽然到CentOS7上也可以装ntp.但是各种坑啊.这次换一个时间同步工具---->chrony ======================== ...
- 网络时间服务和chrony
⽹络时间服务和chrony 实验练习: 准备实验环境: 可用的centos6.7系统. centos6 :192.168.37.6 centos7 :192.168.37.7 关闭selinux 关闭 ...
- Linux 系统时间同步服务器配置
# Linux 时间同步 # 查看系统时间: date # 查看硬件日期 # ntp 软件 # chrony 软件 chrony比ntp更精确 # 利用ntp手动瞬间同步时间: ntpdate 172 ...
- CentOS7.4下部署hadoop3.1.1
CentOS7.4下部署hadoop3.1.1 契机 由于工作原因要部署hadoop的集群,习惯使用最新的稳定版本2018年的时候由于时间紧破部署了2.7.2版本,最新由于又要部署有研究了一下3.x的 ...
随机推荐
- 将日志(Microsoft.Extensions.Logging)添加到.NET Core控制台应用程序
在.NET Core项目中,日志记录是通过依赖项注入进行管理的. 尽管这对于ASP.NET项目效果很好,但在启动Startup.cs中的新项目时,所有这些都会自动创建,而在控制台应用程序中则需要一些配 ...
- python学习笔记:文件操作和集合
一.文件操作 文件读写步骤:有一个文件,打开文件,操作文件读写文件,关闭文件. python 文件读写模式r,r+,w,w+,a,a+的区别(附代码示例) 模式 可做操作 若文件不存在 是否覆盖 r ...
- hql例子
/** * 根据搜索条件查询商品(带缓存) */ public List<ResultInfo> getSearchGoodsList(GoodsTypeCondtionBizBean c ...
- MySQL修改数据库root密码方法
方法1: 用SET PASSWORD命令 mysql -u root mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass ...
- a number of 和the number of用法
a number of 和the number of用法 1. A number of + 複數名詞 + 複數動詞 =some/或a lot of + 複數名詞 + 複數動詞 ...
- sqlServer MERGE 对数据进行修改或插入自动视别 特别用于批量数据的插入或修改
sqlServer MERGE 对数据进行修改或插入自动视别 特别用于批量数据的插入或修改 MERGE customer AS targetTable --目标表 USING ( ...
- LeetCode Array Easy 66. Plus One
Description Given a non-empty array of digits representing a non-negative integer, plus one to the i ...
- activiti网关
activiti中有两种网关:并行网关,排他网关. 排他网关用于任务选择等情况,流程图如下 bpnm代码如下 <?xml version="1.0" encoding=&qu ...
- subst - 替换文件中的定义
总览 (SYNOPSIS) subst [ -e editor ] -f substitutions victim ... 描述 (DESCRIPTION) Subst 能够 替换 文件 的 内容, ...
- codeforces 1198E Rectangle Painting 2 最小点覆盖
题目传送门 题意: 有一个$n∗n$的网格,网格中有一些矩形是黑的,其他点都是白的. 你每次可以花费$ min (h,w)$的代价把一个$h*w$的矩形区域变白.求把所有黑格变白的最小代价. 思路: ...