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   //查看服務狀態 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章