集群時間同步


1、查看本機是否安裝了ntpdate服務,安裝 時間同步軟件

​   yum install -y ntpdate

   yum install -y ntp

2、同步時間

​   ntpdate time.nist.gov // 同步時間

​   如果同步不了

​   ntpdate time.nuri.net // 校驗時間 系統時間

  ​ 把系統時間寫入硬件時間

​   hwclock -w // 寫入時間

-----------------------------------------------------------------------

1、修改時區

  命令:tzselect

​   選擇 5 亞洲

​   9 中國

​   1 北京

  簡單做法:

  cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime // 修改時區為上海

2、集群同步時間:必須是root用戶

  1、沒有ntp的安裝ntp

    rpm -qa | grep ntp // 查看是否安裝

  2、修改配置文件

    vim /etc/ntp.conf

#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap 為
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

#################################################

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 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 stratum 10

  3、修改 /etc/sysconfig/ntpd

  加上:SYNC_HWCLOCK=yes

  4、重新啟動ntpd,添加開機啟動

service ntpd status
service ntpd start
--------------------
添加到開機啟動
chkconfig ntpd on

  5、其他機器配置定時任務,10分鍾 同步一次

crontab -e  編寫定時器同步時間, 意義:每十分鍾與node1 同步一次時間。
需要在集群中其他的機器中都編寫 crontab -e
*/10 * * * * /ntpdata hadoop01

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM