CentOS7 使用chrony搭建集群中的时间同步服务
一、集群环境:
系统:CentOS7-minimal
集群中的两台主机ip:10.132.226.103/24 10.132.226.104/24
二、CentOS7中时间相关命令timedatectl例子介绍:
1.查看主机中的时间信息:timedatectl
- [root@controller ~]# timedatectl
- Local time: Tue -- :: CST
- Universal time: Mon -- :: UTC
- RTC time: Tue -- ::
- Time zone: Asia/Shanghai (CST, +)
- NTP enabled: yes
- NTP synchronized: yes //NTP时间同步开启
- RTC in local TZ: yes
- DST active: n/a
2.查看可获取的时区:timedatectl list-timezones
- [root@controller ~]# timedatectl list-timezones
- Africa/Abidjan
- Africa/Accra
- Africa/Addis_Ababa
- ........
3.设置本地时区:timedatectl set-timezone Asia/Shanghai
- # timedatectl set-timezone Asia/Shanghai
4.设置时间日期等:
- [root@controller ~]# timedatectl set-time "2018-07-19 18:08:08"
- [root@controller ~]# timedatectl set-time "2018-07-19"
- [root@controller ~]# timedatectl set-time "18:08:08"
5.将硬件时钟设置为本地时区:
- [root@controller ~]# timedatectl set-local-rtc 1
6.将硬件时钟设置为协调世界时(UTC):
- [root@controller ~]# timedatectl set-local-rtc
三、安装配置chrony
1.主节点安装:
- [root@controller ~]# yum install -y chrony
2.主节点配置:编辑 /etc/chrony.conf文件
- [root@controller ~]# vim /etc/chrony.conf
- # Use public servers from the pool.ntp.org project.
- # Please consider joining the pool (http://www.pool.ntp.org/join.html).
- #以下0.centos.pool.ntp.org等为远程时间同步服务器可自行更改
- server .centos.pool.ntp.org iburst
- server .centos.pool.ntp.org iburst
- server .centos.pool.ntp.org iburst
- server .centos.pool.ntp.org iburst
- #~~~~~~~~~~~省略若干~~~~~~~~#
- # Allow NTP client access from local network.
- #allow 192.168.0.0/
- #修改!!!
- #此处添加子节点的IP
- allow 10.132.226.104/
- #~~~~~~~~~~~省略若干~~~~~~~~#
3.主节点重启NTP服务
- [root@controller ~]# systemctl enable chronyd.service
- [root@controller ~]# systemctl start chronyd.service
4.子节点安装:
- [root@compute1 ~]# yum install -y chrony
5.子节点配置:编辑 /etc/chrony.conf文件
- [root@compute1 etc]# vim /etc/chrony.conf
- # Use public servers from the pool.ntp.org project.
- # Please consider joining the pool (http://www.pool.ntp.org/join.html).
- #修改 把其他远程同步节点全部注释,并添加主节点ip或者hosts
- #server .centos.pool.ntp.org iburst
- #server .centos.pool.ntp.org iburst
- #server .centos.pool.ntp.org iburst
- #server .centos.pool.ntp.org iburst
- server controller iburst
四、验证同步服务是否搭建成功:
1.使用命令 chronyc sources
- [root@compute1 etc]# chronyc sources
- Number of sources =
- MS Name/IP address Stratum Poll Reach LastRx Last sample
- ===============================================================================
- ^* controller -5232us[-6125us] +/- 47ms
注意:如果controller前为^? 可能是主节点防火墙开启,导致子节点无法进行时间同步。
可以也可以通过timedatectl命令查看:
- [root@compute1 etc]# timedatectl
- Local time: Mon -- :: CST
- Universal time: Mon -- :: UTC
- RTC time: Mon -- ::
- Time zone: Asia/Shanghai (CST, +)
- NTP enabled: yes
- NTP synchronized: yes //此处如果为no说明NTP时钟为开启
- RTC in local TZ: yes
- DST active: n/a
解决方法:关闭主节点防火墙
CentOS7 使用chrony搭建集群中的时间同步服务的更多相关文章
- 如何使用Istio 1.6管理多集群中的微服务?
假如你正在一家典型的企业里工作,需要与多个团队一起工作,并为客户提供一个独立的软件,组成一个应用程序.你的团队遵循微服务架构,并拥有由多个Kubernetes集群组成的广泛基础设施. 由于微服务分布在 ...
- Linux集群配置ntp时间同步服务
集群中时间不同步有可能会让大数据的应用程序运行混乱,造成不可预知的问题,比如Hbase,当时间差别过大时就会挂掉,所以在大数据集群中,ntp服务,应该作为一种基础的服务,以下在演示在CentOS 7. ...
- 使用Cloudrea Manager在CDH集群中添加kafka服务节点,更改borker.id配置后无法启动
需要保证meta.properties文件中的broker.id和cloudrea manager的web页面上kafka配置的broker.id一致,最好让server.properties中的br ...
- Redis 实战篇之搭建集群
Redis 集群简介# Redis Cluster 即 Redis 集群,是 Redis 官方在 3.0 版本推出的一套分布式存储方案.完全去中心化,由多个节点组成,所有节点彼此互联.Redis 客户 ...
- k8s集群中安装rook-ceph
容器的持久化存储 容器的持久化存储是保存容器存储状态的重要手段,存储插件会在容器里挂载一个基于网络或者其他机制的远程数据卷,使得在容器里创建的文件,实际上是保存在远程存储服务器上,或者以分布式的方式保 ...
- 实操教程丨如何在K8S集群中部署Traefik Ingress Controller
注:本文使用的Traefik为1.x的版本 在生产环境中,我们常常需要控制来自互联网的外部进入集群中,而这恰巧是Ingress的职责. Ingress的主要目的是将HTTP和HTTPS从集群外部暴露给 ...
- Centos7环境下etcd集群的搭建
Centos7环境下etcd集群的搭建 一.简介 "A highly-available key value store for shared configuration and servi ...
- centos7搭建集群必知:centos7已经无iptables,只有firewall
1.防火墙概述 centos7搭建集群,发现没有iptables,需要安装.防火墙为firewalle CentOS7默认的防火墙不是iptables,而是firewalle. CentOS 7.0默 ...
- (4)ElasticSearch在linux环境中搭建集群
1.概述 一个运行中的Elasticsearch实例称为一个节点(node),而集群是由一个或者多个拥有相同cluster.name配置的节点组成,它们共同承担数据和负载的压力.当有节点加入集群中或者 ...
随机推荐
- SSRS 2008R2 执行Log 查询
1. 可以参考ExecutionLog3试图,此为系统安装Reporting Service自带的试图. 2. 可以使用以下语句查询: SELECT els.LogEntryId, els.Insta ...
- Android 录音getMaxAmplitude()
这个方法是用来获取在前一次调用此方法之后录音中出现的最大振幅,文档解释如下: Returns the maximum absolute amplitude that was sampled since ...
- restful知识点之二restframework视图
restful协议理解:面向资源开发 restful协议 ---- 一切皆是资源,操作只是请求方式 ----book表增删改查 /books/ books /books/add/ addbook /b ...
- bootstrap 默认显示1899问题
今天使用bootstrap的 dateTimePicker控件时候,又碰到了去年的 显示 1899年的问题,之前解决过,但是忘记了.就记得 他的代码里面有一段是 说格式不正确或者 时间格式小于某个值时 ...
- nginx 两台机器 出现退款失败问题
今天早上来公司后,测试人员告诉我 退款失败了.上周五还好好的,怎么这周三就出问题了,赶快让测试发来订单号,查询数据库,查询日志,发现还是以前的问题: search hit TOP, continuin ...
- SQL Server ->> Natively Compiled Stored Procedures(本地编译存储过程)
Comming soon! 参考: Natively Compiled Stored Procedures
- OutputStream-InputStream-FileOutputStream-FileInputStream-BufferedOutputStream-BufferedInputStream-四种复制方式-单层文件夹复制
字节流两套: java.lang.Object--java.io.OutputStream--java.io.FileOutputStream java.lang.Ob ...
- Linux->Mysql安装调试
环境准备 mysql下载地址:https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar ...
- IONIC调用原生的等待对话框
ngCordova提供了progressIndicator插件,用以方便的显示等待对话框,但是目前版本仅支持安卓版本.为了让苹果版本也显示,可以到以下地址下载通用的插件,JS部分的代码无需改变: ht ...
- MEGER sentence in oracle
MEGE Sentence This oracle tutorial explains how to use the oralce MEGER sentence with syntax and sam ...