Tech Neo技巧沙龙 | 11月25号,九州云/ZStack与您一路商量云时代收集界线治理实践
表里网集群的时光同步①
- Server端:可以拜访外网的机械
- Client端:在内网里的机械
一、server端安装ntp校时包,修改自力主机
rm -rf /etc/localtime #先清除原有的链接文件
CentOS体系安装NTP校时包:
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #修改时区到东8区。
date -R #查看的时区设置。
接下来调剂体系时光与时光办事器同步
Ubuntu体系安装NTP校时包:
Debian体系安装NTP校时包:
代码如下:
- apt-get install ntpdate #安装ntp
CentOS体系安装NTP校时包:
- yum -y install ntpdate ntp #安装ntp
Ubuntu体系安装NTP校时包:
代码如下:
二、server端修改/etc/ntp.conf设备文件
编辑 /etc/ntp.conf
- server cn.pool.ntp.org
- restrict default nomodifynotrapnoquery
- restrict 127.0.0.1 # 开启内部递归收集接口 lo
- restrict 192.168.9.0 mask 255.255.255.0 nomodify notrap #在内部子网琅绫擎的客户端可以 进行收集校时,但不克不及修改NTP办事器的时光参数
因为设备的是本地时光 ,所以还须要设备一个应用体系时钟作为时光源的NTP办事器,须要在/etc/ntp.conf文件中添加如下的记录:
然后保存退出
接着输入下面的敕令:
- ntpdate -d cn.pool.ntp.org #调试查看时光差别
- ntpdate cn.pool.ntp.org #手动校准体系时光
- date -R # 检查时光是否同步
- vi /etc/sysconfig/ntpd
- SYNC_HWCLOCK=yes #同步自力主机的硬件时钟
然后:wq退出
- chkconfig --levels 235 ntpd on #设备开机启动ntp办事,按期同步时光
- /etc/init.d/ntpd start#启动ntp同步
四、client端设备ntpd办事
注:client端包管与server端的收集通行
编辑/etc/ntp.conf文件,前面的┞封两行注释掉落
- #restrict default kod nomodify notrap nopeer noquery
- #restrict -6 default kod nomodify notrap nopeer noquery
- #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
在琅绫擎加上
restrict 办事端地址 nomodify
server 办事端地址 prefer
service ntpd start启动ntpd办事
chkconfig ntpd>
内网linux办事器之间时光同步②
起首设置主机械,先设置时区,在修改设备文件
- rm -rf /etc/localtime #先清除原有的链接文件
- ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #修改时区到东8区。
推荐阅读
Tech Neo技巧沙龙 | 11月25号,九州云/ZStack与您一路商量云时代收集界线治理实践 容器是当今企业数字化转型的>>>详细阅读
本文标题:Linux服务器时间同步那些事
地址:http://www.17bianji.com/lsqh/39001.html
1/2 1

网友点评
精彩导读
科技快报
品牌展示