hbase(main):004:0> create 'userlibrary', {NAME => 'lib', VERSION => 1}
0 row(s) in 1.2460 seconds
hbase(main):005:0> list
TABLE
userdata
userlibrary
2 row(s) in 0.0220 seconds
Note:
1. HBase的运行需要用到zookeeper,而hbase-0.90.3自带了zookeeper,所以可以使用hbase自带的zookeeper. 在conf/hbase-env.sh 文件中export HBASE_MANAGES_ZK=true表示使用hbase自带的zookeeper,如果不想使用其自带的zookeeper,自己下载包安装的话,该项设置为false. 如果自己安装zookeeper,启动及关闭先后顺序为:启动Hadoop—>启动ZooKeeper集群—>启动HBase—>停止HBase—>停止ZooKeeper集群—>停止Hadoop。
2. HBase启动时报错:
localhost: Exception in thread "main" org.apache.hadoop.ipc.RPC$VersionMismatch: Protocol org.apache.hadoop.hdfs.protocol.ClientProtocol version mismatch. (client = 42, server = 41)
是上面hbase安装时没有替换jar包的原因。
3. 运行时可能出现HBase一直等待dfs推出安全模式的情况,Waiting for dfs to exit safe mode
Safe mode is exited when the minimal replication condition is reached, plus an extension time of 30 seconds. The minimal replication condition is when 99.9% of the blocks in the whole filesystem meet their minimum replication level (which defaults to one, and is set by dfs.replication.min).
安全模式的退出前提 - 整个文件系统中的99.9%(默认是99.9%,可以通过dfs.safemode.threshold.pct设置)的Blocks达到最小备份级别(默认是1,可以通过hdf-site.xml中dfs.replication.min设置,比如0.5)。
或者用户可以通过hadoop dfsadmin -safemode value 来操作安全模式,参数value的说明如下:
enter - 进入安全模式
leave - 强制NameNode离开安全模式
get - 返回安全模式是否开启的信息
wait - 等待,一直到安全模式结束