Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1987103
  • 博文数量: 176
  • 博客积分: 1857
  • 博客等级: 上尉
  • 技术积分: 2729
  • 用 户 组: 普通用户
  • 注册时间: 2012-04-14 22:55
个人简介

吾生有涯,而知无涯,适当止学.循序渐进,步步提升 Talk is cheap, show me the code.

文章分类

全部博文(176)

文章存档

2019年(1)

2018年(14)

2017年(20)

2016年(31)

2015年(15)

2014年(5)

2013年(10)

2012年(80)

分类: 数据库开发技术

2012-12-13 16:26:39

1.2. Quick Start

     Loopback IP

     /etc/hosts should look something like this:
      
  1. vi /etc/hosts

  2. 127.0.0.1 localhost
  3. 127.0.0.1 ubuntu.ubuntu-domain ubuntu

1.2.1. Download and unpack the latest stable release.(下载和解压稳定版本)


  1. $ tar xfvz hbase-0.94.3-security.tar.gz
  2. $ cd hbase-0.94.3-security
        安装之前,编辑 conf/hbase-site.xml.其中hbase.rootdir,是Hbase写数据的目录
                                           其中hbase.zookeeper.property.dataDir,是ZooKeeper写数据的目录


  1. hbase.rootdir
  2. /data/hbase
  3. hbase.zookeeper.property.dataDir
  4. /data/zookeeper

1.2.2. Start HBase


  1. [root@ZSDDB8 hbase-0.94.3-security]# ./bin/start-hbase.sh
  2. 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

  1. [root@ZSDDB8 hbase-0.94.3-security]# ./bin/hbase shell
  2. HBase Shell; enter 'help' for list of supported commands.
  3. Type "exit" to leave the HBase Shell
  4. Version 0.94.3, r1408904, Wed Nov 14 16:41:36 UTC 2012

  5. hbase(main):001:0>

创建一个表为test且一个列集合为cf。通过list 'test'验证它的创建然后插入一些数据


  1. hbase(main):003:0> create 'test', 'cf'
  2. 0 row(s) in 1.2200 seconds
  3. hbase(main):002:0> list 'test'
  4. TABLE
  5. test
  6. 1 row(s) in 0.0170 seconds
  7. 1 row(s) in 0.0550 seconds
  8. hbase(main):004:0> put 'test', 'row1', 'cf:a', 'value1'
  9. 0 row(s) in 0.0560 seconds
  10. hbase(main):005:0> put 'test', 'row2', 'cf:b', 'value2'
  11. 0 row(s) in 0.0370 seconds
  12. hbase(main):006:0> put 'test', 'row3', 'cf:c', 'value3'
  13. 0 row(s) in 0.0450 seconds
通过执行scan 命令验证刚插入的数据


  1. hbase(main):006:0> scan 'test'
  2. ROW COLUMN+CELL
  3. row1 column=cf:a, timestamp=1355386368983, value=value1
  4. row2 column=cf:b, timestamp=1355386374028, value=value2
  5. row3 column=cf:c, timestamp=1355386377745, value=value3
  6. 3 row(s) in 0.0600 seconds
得到一行的数据

  1. hbase(main):007:0> get 'test', 'row1'
  2. COLUMN CELL
  3. cf:a timestamp=1355386368983, value=value1
  4. 1 row(s) in 0.0330 seconds
现在disable然后drop掉你的表,就可以清除上面你做的所有操作


  1. hbase(main):008:0> disable 'test'
  2. 0 row(s) in 2.0730 seconds

  3. hbase(main):009:0> drop 'test'
  4. 0 row(s) in 0.1100 seconds
退出

  1. hbase(main):013:0> exit
1.2.4. Stopping HBase

执行stop-hbase.sh关闭HBase

  1. $ ./bin/stop-hbase.sh
  2. [root@ZSDDB8 hbase-0.94.3-security]# ./bin/stop-hbase.sh
  3. 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.








阅读(2298) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~