北在北方

太白枝头看,花开不计年,杯中浮日月,楼外是青天。

导航

启动HBase后遇到的一个问题

Posted on 2013-04-13 17:32  CN.programmer.Luxh  阅读(1846)  评论(0编辑  收藏  举报

  有好几次,启动Hadoop和HBase之后,执行jps命令,已经看到有HMaster的进程,

  但是进入到HBase的shell,执行一个命令,会出现下面的错误:

ERROR: org.apache.hadoop.hbase.MasterNotRunningException: Retried 7 times

  进入到logs目录查看master的日志:发现一直显示下面的内容:

2013-04-13 17:13:17,374 INFO org.apache.hadoop.hbase.util.FSUtils: Waiting for dfs to exit safe mode...
2013-04-13 17:13:27,377 INFO org.apache.hadoop.hbase.util.FSUtils: Waiting for dfs to exit safe mode...
2013-04-13 17:13:37,386 INFO org.apache.hadoop.hbase.util.FSUtils: Waiting for dfs to exit safe mode...
2013-04-13 17:13:47,393 INFO org.apache.hadoop.hbase.util.FSUtils: Waiting for dfs to exit safe mode...
2013-04-13 17:13:57,395 INFO org.apache.hadoop.hbase.util.FSUtils: Waiting for dfs to exit safe mode...
2013-04-13 17:14:07,409 INFO org.apache.hadoop.hbase.util.FSUtils: Waiting for dfs to exit safe mode...

  原来是Hadoop在刚启动的时候,还处在安全模式造成的。

[coder@h1 hadoop-0.20.2]$ bin/hadoop dfsadmin -safemode get
Safe mode is ON
[coder@h1 hadoop-0.20.2]$ 

  可等Hadoop退出安全模式后再执行HBase命令,或者手动退出Hadoop的安全模式

[coder@h1 hadoop-0.20.2]$ bin/hadoop dfsadmin -safemode leave
Safe mode is OFF
[coder@h1 hadoop-0.20.2]$ 

  现在再执行HBase的命令就没有问题了:

[coder@h1 hbase-0.90.5]$ bin/hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.90.5, r1212209, Fri Dec  9 05:40:36 UTC 2011

hbase(main):001:0> list
TABLE                                                                                                                          
student                                                                                                                        
user                                                                                                                           
2 row(s) in 0.7530 seconds

hbase(main):002:0>