网址:
http://hbase.apache.org/book/configuration.html#basic.prerequisites
最新版本:hbase-0.98.3可适应hadoop版本:2.3.0
2、下载解压
3、修改Java环境变量
vi conf/hbase-env.sh
export JAVA_HOME=/usr/java/jdk1.6.0_31/
4、SSH端口不是默认22端口,需要修改HBASE的端口
vi conf/hbase-env.sh
export HBASE_SSH_OPTS="-p 222"
5、修改hbase-site.xml配置
<configuration> <property> <name>hbase.rootdir</name> <value>file:///usr/xxxx/tmp/hbase</value> </property> <property> <name>hbase.zookeeper.property.dataDir</name> <value>/usr/xxxx/tmp/zookeeper</value> </property> <property> <name>hbase.cluster.distributed</name> <value>true</value> </property> </configuration>
6、启动和停止
$ ./bin/start-hbase.sh
$ ./bin/stop-hbase.sh
7、操作示例
Connect to your running HBase via the shell. $ ./bin/hbase shell HBase Shell; enter 'help<RETURN>' for list of supported commands. Type "exit<RETURN>" to leave the HBase Shell Version: 0.90.0, r1001068, Fri Sep 24 13:55:42 PDT 2010 hbase(main):001:0> Type help and then <RETURN> to see a listing of shell commands and options. Browse at least the paragraphs at the end of the help emission for the gist of how variables and command arguments are entered into the HBase shell; in particular note how table names, rows, and columns, etc., must be quoted. Create a table named test with a single column family named cf. Verify its creation by listing all tables and then insert some values. hbase(main):003:0> create 'test', 'cf' 0 row(s) in 1.2200 seconds hbase(main):003:0> list 'test' .. 1 row(s) in 0.0550 seconds hbase(main):004:0> put 'test', 'row1', 'cf:a', 'value1' 0 row(s) in 0.0560 seconds hbase(main):005:0> put 'test', 'row2', 'cf:b', 'value2' 0 row(s) in 0.0370 seconds hbase(main):006:0> put 'test', 'row3', 'cf:c', 'value3' 0 row(s) in 0.0450 seconds Above we inserted 3 values, one at a time. The first insert is at row1, column cf:a with a value of value1. Columns in HBase are comprised of a column family prefix -- cf in this example -- followed by a colon and then a column qualifier suffix (a in this case). Verify the data insert by running a scan of the table as follows hbase(main):007:0> scan 'test' ROW COLUMN+CELL row1 column=cf:a, timestamp=1288380727188, value=value1 row2 column=cf:b, timestamp=1288380738440, value=value2 row3 column=cf:c, timestamp=1288380747365, value=value3 3 row(s) in 0.0590 seconds Get a single row hbase(main):008:0> get 'test', 'row1' COLUMN CELL cf:a timestamp=1288380727188, value=value1 1 row(s) in 0.0400 seconds Now, disable and drop your table. This will clean up all done above. hbase(main):012:0> disable 'test' 0 row(s) in 1.0930 seconds hbase(main):013:0> drop 'test' 0 row(s) in 0.0770 seconds Exit the shell by typing exit. hbase(main):014:0> exit