记一次 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 系统  配置节点间时间同步 配置完毕!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章