做任何事都要經受得挫折,要有恒心和毅力,滿懷信心堅持到底
Hadoop配置集群事件同步
時間同步方式
找一臺機器,作為時間服務器,所有的機器與這臺集群時間進行定時的同步,比如,每隔十分鐘,同步一次時間
配置時間同步步驟
1.時間服務器配置(必須root用戶)
rpm -qa|grep ntp

2.修改ntp組態檔
vi /etc/ntp.conf
修改內容如下
a)修改1(授權192.168.1.0網段上的所有機器可以從這臺機器上查詢和同步時間)
打開限制
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap為
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
b)修改2(集群在局域網中,不使用其他的網路時間)
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
c)添加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
service ntpd status
service ntpd start
5.加入配置項
chkconfig ntpd on
6.其他機器配置(必須root用戶)
(1) 撰寫定時任務10分鐘和主時間服務器同步一次
crontab -e
撰寫定時任務如下:
*/10 * * * * /usr/sbin/ntpdate hadoop102
(2)修改任意時間
date -s "2017-9-11 11:11:11"
(3)十分鐘后查看是否同步成功
date
相關資料

本文配套GitHub:https://github.com/zhutiansama/FocusBigData
本文配套公眾號:FocusBigData
回復【大資料面經】【大資料面試經驗】【大資料學習路線圖】會有驚喜哦
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/154800.html
標籤:Java
上一篇:Redis可以用作訊息佇列嗎?
下一篇:Object的記憶體布局
