Hadoop集群时间同步

Hadoop集群时间同步

1.时间同步源配置(必须为root用户)

  1. 检查是否安装ntp服务

    命令

    
    # rpm -qa |grep ntp
    

    如果有以下三个软件就不需要安装,否则自行安装

    fontpackages-filesystem-1.41-1.1.el6.noarch
    ntp-4.2.6p5-10.el6.centos.x86_64
    ntpdate-4.2.6p5-10.el6.centos.x86_64

  2. 修改ntp的配置文件

    命令

    $ vim /etc/ntp.conf

    需要修改的内容

    
    # Hosts on local network are less restricted.
    
    
    #打开这一句的注释,修改自己的网段
    
    restrict 192.168.10.0 mask 255.255.255.0 nomodify notrap
    
    
    # Use public servers from the pool.ntp.org project.
    
    
    # Please consider joining the pool (http://www.pool.ntp.org/join.html).
    
    
    #注释到下面的四行
    
    
    #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
    
    
    
    #添加这个两句
    
    
    #设置本地服务器为根时间服务器
    
    server 127.127.1.0
    fudge 127.127.1.0 startum 10
  3. 同步时间到RTC

    命令

    
    # vi /etc/sysconfig/ntpd
    

    添加内容

    SYNC_HWCLOCK=yes

  4. 重新启动ntpd

    查看ntpd服务的状态

    
    # service ntpd status
    

    开启ntpd服务

    
    # service ntpd start
    
    
    # chkconfig ntpd on 
    

2.其他主机配置(必须为root用户)

使用corntab设置定时更新,添加crontab任务命令添加crontab任务命令

# crontab -e

添加内容

# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed
*/10 * * * * /usr/sbin/ntpdate hadoop101

corntab服务相关命令

   service crond start    //启动服务
  service crond stop     //关闭服务
  service crond restart  //重启服务
  service crond reload   //重新载入配置
  service crond status   //查看服务状态 
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值