Hadoop 集群时间同步

一、crond 系统定时任务

1、启动服务

service crond start

2、crontab基本语法

*    *    *    *    *
分  时  日  月  星期(0-7)0和 7代表 星期日
特殊符号
*    代表任意时间
,     代表不连续的时间
-    代表连续的时间
*/n    代表每隔多久执行一次

 二、集群时间同步

注意:root用户操作

1、安装 ntp
yum update
yum -y install ntp
2、用ntpdate同步时间命令
ntpdate -u cn.pool.ntp.org
3、设置国内时间timedatectl 
set-timezone Asia/Shanghai

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

下面的操作没起效果,故放弃

概念:找一台机器作为时间服务器,所有的机器与该机器进行时间同步

A、时间服务器(wt1)

1、安装 ntp

yum update
yum -y install ntp

2、修改npt配置文件

vim /etc/ntp.conf

1)、允许这个网段的节点,访问这个时间服务器,取消注释、修改

 2)、不使用其它互联网的时间,添加注释

 3)、网络断开连接,采取本地时间,添加内容

server 127.127.1.0
fudge 127.127.1.0 stratum 10

 3、修改 /etc/sysconfig/ntpd

vim /etc/sysconfig/ntpd
SYNC_HWCLOCK=yes

4、重启ntpd,并设置开机启动

systemctl restart ntpd
systemctl enable ntpd
原文地址:https://www.cnblogs.com/wt7018/p/13583726.html