close

今天啟動HBase時發現只有在master01才有HMaster出現

slave01,02的HRegionServer都沒有出現在jps

抓了slave01的log出來看 發現以下Error

2014-08-28 07:32:40,370 FATAL [regionserver60020] regionserver.HRegionServer: Master rejected startup because clock is out of sync
org.apache.hadoop.hbase.ClockOutOfSyncException: org.apache.hadoop.hbase.ClockOutOfSyncException: Server slave01,60020,1409182358666 has been rejected; Reported time is too far out of sync with master. Time difference of 86349124ms > max allowed of 30000ms

 

看起來是機器上的時間差超過了default的容忍度 因為HBase他有一個叫timestamp的機制會記錄各個value產生的時間 可以當作版本

想當然 機器上的時間不同步會有版本的問題 所以我們參考鳥哥的Linux網頁

http://linux.vbird.org/linux_server/0440ntp.php#client_linux

在15.3.2章節有提到要如何sync各台機器的時間

 

1. 先下載ntp

yum install ntpdate (注意:我使用yum install ntp會找不到ntpdate)

 

 

2. 執行

ntpdate tick.stdtime.gov.twntpdate 118.163.81.62

有看到adjust time server... 或 step time server... 就表示有成功

 

 

3. 寫入CMOS

date; hwclock -r

這樣我們master01的時間就與國家標準時間同步了

 

 

4. 把master01設定為ntp伺服器 以後讓slave們可以與他同步時間

vi /etc/ntp.conf

restrict 127.0.0.1
restrict -6 ::1

這兩個下方增加

restrict 192.168.70.0 mask 255.255.255.0 nomodify
server 127.127.1.0
fudge 127.127.1.0 stratum 8

防止no server suitable for synchronization found的error

 

 

5. 啟動NTP server

/etc/init.d/ntpd start
chkconfig ntpd on

 

 

6. 檢查是否有啟動

watch ntpq -p

 

是否有出現以下訊息


Every 2.0s: ntpq -p Thu Jul 10 02:28:32 2008

remote refid st t when poll reach delay offset jitter

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

 

 

7.  slave01 和slave02與master01同步

ntpdate master01

 

 

8.讓slave01和slave02以後都能自動同步更新

vi /etc/crontab

加入 使他每天21:30都能自動同步
30 21 * * * root (/usr/sbin/ntpdate master01 && /sbin/hwclock -w) &> /dev/null

 

 

9. 啟動HBase

hbase  

終於出現HRegionServer拉~~~

 

 

 

 

 

打完收工

 

arrow
arrow
    全站熱搜

    kurthung1224 發表在 痞客邦 留言(0) 人氣()