1.2. Quick Start Loopback IP
/etc/hosts should look something like this:
- vi /etc/hosts
- 127.0.0.1 localhost
- 127.0.0.1 ubuntu.ubuntu-domain ubuntu
1.2.1. Download and unpack the latest stable release.(下载和解压稳定版本)
- $ tar xfvz hbase-0.94.3-security.tar.gz
- $ cd hbase-0.94.3-security
安装之前,编辑 conf/hbase-site.xml.其中hbase.rootdir,是Hbase写数据的目录
其中hbase.zookeeper.property.dataDir,是ZooKeeper写数据的目录
-
- hbase.rootdir
- /data/hbase
-
-
- hbase.zookeeper.property.dataDir
- /data/zookeeper
-
1.2.2. Start HBase- [root@ZSDDB8 hbase-0.94.3-security]# ./bin/start-hbase.sh
- starting master, logging to /root/hbase-0.94.3-security/bin/../logs/hbase-root-master-ZSDDB8.out
这样就算开启了单实例的HBase
Is java Installed?可以查看http://blog.chinaunix.net/space.php?uid=26446098&do=blog&id=3438622 java7安装方式
1.2.3. Shell Exercises通过shell连接HBASE
- [root@ZSDDB8 hbase-0.94.3-security]# ./bin/hbase shell
- HBase Shell; enter 'help' for list of supported commands.
- Type "exit" to leave the HBase Shell
- Version 0.94.3, r1408904, Wed Nov 14 16:41:36 UTC 2012
- hbase(main):001:0>
创建一个表为test且一个列集合为cf。通过list 'test'验证它的创建然后插入一些数据
- hbase(main):003:0> create 'test', 'cf'
- 0 row(s) in 1.2200 seconds
- hbase(main):002:0> list 'test'
- TABLE
- test
- 1 row(s) in 0.0170 seconds
- 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
通过执行scan 命令验证刚插入的数据
- hbase(main):006:0> scan 'test'
- ROW COLUMN+CELL
- row1 column=cf:a, timestamp=1355386368983, value=value1
- row2 column=cf:b, timestamp=1355386374028, value=value2
- row3 column=cf:c, timestamp=1355386377745, value=value3
- 3 row(s) in 0.0600 seconds
得到一行的数据
- hbase(main):007:0> get 'test', 'row1'
- COLUMN CELL
- cf:a timestamp=1355386368983, value=value1
- 1 row(s) in 0.0330 seconds
现在disable然后drop掉你的表,就可以清除上面你做的所有操作
- hbase(main):008:0> disable 'test'
- 0 row(s) in 2.0730 seconds
- hbase(main):009:0> drop 'test'
- 0 row(s) in 0.1100 seconds
退出
1.2.4. Stopping HBase执行stop-hbase.sh关闭HBase
- $ ./bin/stop-hbase.sh
- [root@ZSDDB8 hbase-0.94.3-security]# ./bin/stop-hbase.sh
- stopping hbase...........
1.2.5. Where to go next
The above described standalone setup is good for testing and
experiments only. In the next chapter, ,
we'll go into depth on the different HBase run modes, system requirements
running HBase, and critical configurations setting up a distributed HBase deploy.
阅读(2294) | 评论(0) | 转发(0) |