zoukankan      html  css  js  c++  java
  • Hbase初体验

    1、配置

    (1)编辑$HBASE_HOME/conf/ hbase-env.sh配置环境变量JAVA_HOME;

    (2)编辑$HBASE_HOME/conf/hbase-site.xml, 增加如下配置(与Hadoop保持一致):

    <property>
        <name>hbase.rootdir</name>
        <value>hdfs://localhost:9000/hbase</value>
        <description>The directory shared by region servers.
        </description>
     </property>

    2、使用

    #启动HBase
    [root@yy1 hbase-0.20.5]# bin/start-hbase.sh
    localhost: starting zookeeper, logging to /root/hadoop/hbase-0.20.5/bin/../logs/hbase-root-zookeeper-yy1.out
    starting master, logging to /root/hadoop/hbase-0.20.5/bin/../logs/hbase-root-master-yy1.out
    localhost: starting regionserver, logging to /root/hadoop/hbase-0.20.5/bin/../logs/hbase-root-regionserver-yy1.out

    [root@yy1 hbase-0.20.5]# bin/hbase shell
    HBase Shell; enter 'help<RETURN>' for list of supported commands.
    Version: 0.20.5, r956266, Sat Jun 19 12:25:12 PDT 2010
    hbase(main):001:0>

    #创建表test
    hbase(main):003:0> create "test","data"
    0 row(s) in 1.3560 seconds
    hbase(main):004:0> describe "test"
    DESCRIPTION                                                             ENABLED
     {NAME => 'test', FAMILIES => [{NAME => 'data', COMPRESSION => 'NONE',  true
     VERSIONS => '3', TTL => '2147483647', BLOCKSIZE => '65536', IN_MEMORY
     => 'false', BLOCKCACHE => 'true'}]}
    1 row(s) in 0.0610 seconds

    #插入数据
    hbase(main):005:0> put "test","row1","data:1","value1"
    0 row(s) in 0.0060 seconds
    hbase(main):006:0> put "test","row2","data:2","value2"
    0 row(s) in 0.0100 seconds
    hbase(main):007:0> scan "test"
    ROW                          COLUMN+CELL
     row1                        column=data:1, timestamp=1277968472718, value=value1
     row2                        column=data:2, timestamp=1277968487913, value=value2
    2 row(s) in 0.0350 seconds

    hbase(main):009:0> get "test", "row1"
    COLUMN                       CELL
     data:1                      timestamp=1277968472718, value=value1
    1 row(s) in 0.0100 seconds

    #停止HBase
    [root@yy1 hbase-0.20.5]# bin/stop-hbase.sh
    stopping master..............................
    localhost: stopping zookeeper.

    #HBase创建的文件
    [root@yy1 hadoop-0.20.2]# bin/hadoop fs -ls /hbase
    Found 5 items
    drwxr-xr-x   - root supergroup          0 2010-07-01 14:51 /hbase/-ROOT-
    drwxr-xr-x   - root supergroup          0 2010-07-01 14:51 /hbase/.META.
    drwxr-xr-x   - root supergroup          0 2010-07-01 15:18 /hbase/.logs
    -rw-r--r--   3 root supergroup          3 2010-07-01 14:51 /hbase/hbase.version
    drwxr-xr-x   - root supergroup          0 2010-07-01 15:12 /hbase/test
    [root@yy1 hadoop-0.20.2]# bin/hadoop fs -ls /hbase/test
    Found 1 items
    drwxr-xr-x   - root supergroup          0 2010-07-01 15:18 /hbase/test/1886847087

  • 相关阅读:
    c++函数模板
    C++左移运算符重载
    and or bool and a or b 原理解释
    Python的垃圾回收机制
    《C++ 101条建议》学习笔记——第一章快速入门
    在应用中嵌入Python:转
    使用C++扩展Python的功能 转自:http://blog.csdn.net/magictong/article/details/8897568#comments
    python扩展实现方法--python与c混和编程 转自:http://www.cnblogs.com/btchenguang/archive/2012/09/04/2670849.html
    python文件头的#-*- coding: utf-8 -*- 的作用
    Pythhon 字典 key in dict 比 dict.has_key (key)效率高 为什么?
  • 原文地址:https://www.cnblogs.com/hustcat/p/1769219.html
Copyright © 2011-2022 走看看