栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Centos(rocky,red Hat)搭建npt服务,采用阿里ntp时间,保证时间一致性时间

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Centos(rocky,red Hat)搭建npt服务,采用阿里ntp时间,保证时间一致性时间

目的:保证分布式环境所有机器的时间具有一致性 1、 安装npt服务

#安装ntp服务

yum install ntp

#开机启动服务

systemctl enable ntpd

#启动服务

systemctl start ntpd

#更改时区

timedatectl set-timezone Asia/Shanghai

2、修改默认配置文件

vim /etc/ntp.conf
# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

#设置ntp1.aliyun.com可以修改本地系统时间
restrict ntp.aliyun.com nomodify notrap noquery
#设置阿里云NTP服务器
server ntp.aliyun.com
server ntp1.aliyun.com
server ntp2.aliyun.com
server ntp3.aliyun.com
server ntp4.aliyun.com
server ntp5.aliyun.com
server ntp6.aliyun.com
server ntp7.aliyun.com

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst#注释以上默认NTP服务器

3、重启服务

#重启NTP服务

systemctl restart ntpd

4.进行单词时间同步

#单次同步时间
ntpdate ntp.aliyun.com
#启用ntp同步
timedatectl set-ntp yes

5.查看同步状态

ntpq -p #查看NTP服务同步状态,见下面输出代表成功
remote refid st t when poll reach delay offset jitter

==============================================================================

120.25.115.20 10.137.53.7 2 u 9 64 1 47.461 0.578 0.000

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/830716.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号