转载,侵删,原文链接: https://www.aliyun.com/jiaocheng/118626.html
- 发表文章
- 摘要:Linux时间同步方式一:设置时区cp/usr/share/zoneinfo/Asia/Shanghai/etc/localtime联网情况:ntpdateus.pool.ntp.org运行结果:方式二:查看NTP状态servicentpdstatusyuminstall-yntpdchkconfigntpdon查看时区:date-R同步网络时间ntpdate1.centos.pool.ntp.org结果展示:方式三:(集群中常用的方法)配置ntp服务端:vi/etc/ntp
-
Linux时间同步
方式一:
设置时区
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
联网情况:ntpdate us.pool.ntp.org运行结果:
方式二:
查看NTP状态
service ntpd status
yum install -y ntpdchkconfig ntpd on
查看时区:
date -R
同步网络时间
ntpdate 1.centos.pool.ntp.org
结果展示:方式三:(集群中常用的方法)
配置ntp服务端:
vi /etc/ntp.conf
restrict 172.16.0.0 mask 255.255.255.0 nomodify notrap
使用本地时钟
server 127.127.1.0
fudge 127.127.1.0 stratum 10
保存退出开启防火墙udp 123端口
iptables -I INPUT -p udp –dport 123 -j ACCEPT
service iptables save在启动ntpd服务之前,先使用ntpdate手动同步下时间,免得本机与外部时间服务器时间差距太大,让ntpd不能正常同步。
ntpdate 0.centos.pool.ntp.org启动ntpd服务
service ntpd start步骤跟踪:
在子集群中运行
ntpdate 配置好了的主机名,实现集群时间同步 - 以上是Linux上三种方式--ntp时间同步的内容,更多 上三 同步 方式 时间 Linux NTP 的内容,请您使用右上方搜索功能获取相关信息。