1. 程式人生 > >Hbase 常見錯誤總結——摘自忘了

Hbase 常見錯誤總結——摘自忘了

cti status 不同步 fat reducer led cep issue html

一、執行$ hbase hbck 命令時,出現以下提示:

Invalid maximum heap size: -Xmx4096m
The specified size exceeds the maximum representable size.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

原因:jvm設置的內存過大,減小配置文件hbase-env.sh內的設置即可。例如:

export HBASE_HEAPSIZE=1024

二、無法啟動hbase,regionserver log裏會有這樣的錯誤,zookeeper也有初始化問題的錯誤

FATAL org.apache.hadoop.hbase.regionserver.HRegionServer: ABORTING region server 10.210.70.57,60020,1340088145399: Initialization of RS failed. Hence aborting RS.

因為之前安裝配置的時候是好好的,中間經歷過強行kill daemon的過程,又是報錯初始化問題,所以估計是有緩存影響了,所以清理了tmp裏的數據,然後發現HRegionServer依然無法啟動,不過還好的是zookeeper啟動了,一怒之下把hdfs裏的hbase數據也都清理了,同時再清理tmp,檢查各個節點是否有殘留hbase進程,kill掉,重啟hbase,然後這個世界都正常了。不知道具體哪裏影響了,不推薦這種暴力解決辦法,如果有誰知道原因請告之。

三、無法啟動reginserver daemon,報錯如下:

Exception in thread "main" java.lang.RuntimeException: Failed construction of Regionserver: class org.apache.hadoop.hbase.regionserver.HRegionServer
...
Caused by: java.net.BindException: Problem binding to /10.210.70.57:60020 : Cannot assign requested address

根據錯誤提示,檢查ip對應的機器是否正確,如果出錯機器的ip正確,檢查60020端口是否被占用。

四、執行hbase程序orshell命令出現如下提示:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/hbase-0.92.1/lib/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/hadoop-1.0.3/lib/slf4j-log4j12-1.4.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

是因為hbase和hadoop裏都有這個jar包,選擇其一移除即可。

五、執行hbase的mapreduce作業,有些節點無任何報錯正常執行,有些節點總報類似Status : FAILED
java.lang.NullPointerException的錯誤,查看tasktracker的log日誌有如下錯誤:

WARN org.apache.zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
...
caused by java.net.ConnectException: Connection refused

官方對這個錯誤給了說明,

Errors like this... are either due to ZooKeeper being down, or unreachable due to network issues.

當初配置zookeeper時只說盡量配置奇數節點防止down掉一個節點無法選出leader,現在看這個問題貌似所以想執行任務的節點都必須配置zookeeper啊。

六、報告找不到方法異常,但是報告的函數並非自己定義的,也並沒有調用這樣的函數,類似信息如下:

java.lang.RuntimeException: java.lang.NoSuchMethodException: com.google.hadoop.examples.Simple$MyMapper.()
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:45)
at org.apache.hadoop.mapred.MapRunner.configure(MapRunner.java:32)
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:53)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:209)
at org.apache.hadoop.mapred.TaskTracker$Child.main(TaskTracker.java:1210)
Caused by: java.lang.NoSuchMethodException: com.google.hadoop.examples.Simple$MyMapper.()
at java.lang.Class.getConstructor0(Class.java:2705)
at java.lang.Class.getDeclaredConstructor(Class.java:1984)
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:41)
... 4 more

網上找到解決方法如下:

This is actually the() function. The display on the web page doesn‘t translate into html, but dumps plain text, sois treated as a (nonexistant) tag by your browser. This function is created as a default initializer for non-static classes. This is most likely caused by having a non-static Mapper or Reducer class. Try adding the static keyword to your class declaration, ie:

意思是缺少static關鍵字~添加上即可。如下:

public static class MyMapper extends MapReduceBase implements Mapper {...}

七、使用mapreduce程序寫HFile操作hbase時,可能會有這樣的錯誤:


java.lang.IllegalArgumentException: Can‘t read partitions file
...
Caused by: java.io.IOException: wrong key class: org.apache.hadoop.io.*** is not class org.apache.hadoop.hbase.io.ImmutableBytesWritable

這裏需要註意的是無論是map還是reduce作為最終的輸出結果,輸出的key和value的類型應該是:< ImmutableBytesWritable, KeyValue> 或者< ImmutableBytesWritable, Put>。改成這樣的類型就行了。

八、如果啟動hbase集群出現regionserver無法啟動,日誌報告如下類似錯誤時,說明是集群的時間不同步,只需要同步即可解決。

FATAL org.apache.hadoop.hbase.regionserver.HRegionServer: ABORTING region server 10.210.78.22,60020,1344329095415: Unhandled exceptio
n: org.apache.hadoop.hbase.ClockOutOfSyncException: Server 10.210.78.22,60020,1344329095415 has been rejected; Reported time is too far out of sync with mast
er. Time difference of 90358ms > max allowed of 30000ms
org.apache.hadoop.hbase.ClockOutOfSyncException: org.apache.hadoop.hbase.ClockOutOfSyncException: Server 10.210.78.22,60020,1344329095415 has been rejected;
Reported time is too far out of sync with master. Time difference of 90358ms > max allowed of 30000ms
......
Caused by: org.apache.hadoop.ipc.RemoteException: org.apache.hadoop.hbase.ClockOutOfSyncException: Server 10.210.78.22,60020,1344329095415 has been rejected;
Reported time is too far out of sync with master. Time difference of 90358ms > max allowed of 30000ms

只需要執行一下這條命令即可同步國際時間:

/usr/sbin/ntpdate tick.ucla.edu tock.gpsclock.com ntp.nasa.gov timekeeper.isi.edu usno.pa-x.dec.com;/sbin/hwclock --systohc > /dev/null

Hbase 常見錯誤總結——摘自忘了