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配置的节点组成,它们共同承担数据和负载的压力.当有节点加入集群中或者 ...
随机推荐
- 老生常谈:++a与a--区别
a++的作用是先对a进行操作再++:a--则相反. 如: int a = 1;int b = a++; //此时先运算b=a,再a++,故b=1,a=2int c = --a; //此时先--a,再运 ...
- arcgis 地理国情建库软件已完成
arcgis 地理国情软件已完成: 1.创建1:25000(或则其他比例尺)国家2000坐标系接合表 2.按照地理国情普查数据库标准,创建标准数据库 3.外业调查工作底图制作 4.矢量和影像数据批量裁 ...
- nyist 20 吝啬的国度(dfs)
吝啬的国度 题目描述: 在一个吝啬的国度里有N个城市,这N个城市间只有N-1条路把这个N个城市连接起来. 现在,Tom在第S号城市,他有张该国地图,他想知道如果自己要去参观第T号城市, 必须经过的前一 ...
- Revit
log file Windows Vista or Windows 7:%LOCALAPPDATA%\Autodesk\Revit\Autodesk Revit 2016\Journals
- Unity导出APk出错解决方法二
错误提示(需得打开编辑器log文件才能看到全部log,Unity3d只显示一部分): Error building Player: CommandInvokationFailure: Unable t ...
- springmvc中配置RESTful风格控制器
一般的http请求中其实只需要get和post就可以满足项目需求了,而为什么还要使用restful可能就是为了使请求url看起来更加直观,好看吧.. restful常用的请求方式:get,post,p ...
- androidcookie
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { webSettings.setAllowFileAccessFrom ...
- P4python: python interface to Perforce API
P4python is the python interface to Perforce API, it helps to do Perforce operations through python. ...
- Oracle归档模式和非归档模式的区别
一.查看oracle数据库是否为归档模式: Sql代码1.select name,log_mode from v$database; NAME LOG_MODE ------------------ ...
- win+ R下的常见命令
-------------------------电脑运行常见命令----------------------------- Windows+R输入cmd 运行net start mssqlserve ...