记一次 Centos7.4 系统 配置节点间时间同步

QQ交流群:64655993   希望能对您有所帮助!!!

说明:

1、本文以阿里时间服务器为准,阿里云时间服务器地址:ntp6.aliyun.com

2、如有专用时间服务器,请更改时间服务器的主机名或者IP地址,主机名和IP 需要在etc/hosts文件中做好映射。

3、系统需连接互联网(因为需要安装ntp工具以及与阿里或其他公网时间服务器通讯,如果系统已安装ntp工具且具有内网时间服务器,此条件可忽略)

配置过程:

1、设置系统时区为东八区(上海时区)

[root@localhost ~]# timedatectl set-timezone Asia/Shanghai

2、安装基本工具

[root@localhost ~]# yum install -y ntp

3、关闭ntpd服务

[root@localhost ~]# systemctl stop ntpd.service

(说明:Centos6.* 系统命令与Centos7.* 会有区别)

4、设置ntpd服务禁止开机启动

[root@localhost ~]# systemctl disable ntpd

(说明:Centos6.* 系统命令与Centos7.* 会有区别)

5、设置定时任务

[root@localhost ~]# crontab -e

6、写入以下内容(每10分钟同步一下阿里云时间服务器):

0-59/10 * * * * /usr/sbin/ntpdate ntp6.aliyun.com

7、重启定时任务服务

[root@localhost ~]# /bin/systemctl restart crond.service

8、设置定时任务开机启动

[root@localhost ~]# vim /etc/rc.local

9、加入以下内容后,保存并退出    :wq

/bin/systemctl start crond.service

(说明:Centos6.* 系统命令与Centos7.* 会有区别)

 

至此,Centos7.4 系统  配置节点间时间同步 配置完毕!

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值