启动hbase shell

    1. # hbase shell

    不需要使用分号,可以直接两个单引号’处理

    1. hbase(main):002:0> list;
    2. hbase(main):003:0* '
    3. hbase(main):004:0' '
    4. TABLE
    5. kylin_metadata
    6. 1 row(s) in 0.0130 seconds
    7. => "\n"
    1. hbase(main):001:0> list
    2. TABLE
    3. kylin_metadata
    4. 1 row(s) in 0.5110 seconds
    5. => ["kylin_metadata"]

    创建表,必须指定

    1. hbase(main):017:0> create 'student','base_info'
    2. 0 row(s) in 1.4950 seconds
    3. => Hbase::Table - student
    4. hbase(main):018:0> create 'stu','info','addr'
    5. 0 row(s) in 1.2680 seconds
    6. => Hbase::Table - stu

    查看表,

    1. desc 'student'
    2. Table student is ENABLED
    3. student
    4. COLUMN FAMILIES DESCRIPTION
    5. {NAME => 'base_info', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '
    6. 0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}
    7. 1 row(s) in 0.0630 seconds

    删除,需要先禁止disable操作

    1. hbase(main):021:0> drop 'student'
    2. ERROR: Table student is enabled. Disable it first.
    3. Here is some help for this command:
    4. Drop the named table. Table must first be disabled:
    5. hbase> drop 't1'
    6. hbase> drop 'ns1:t1'
    7. hbase(main):022:0> disable 'student'
    8. 0 row(s) in 2.2850 seconds
    9. hbase(main):023:0> drop 'student'
    10. 0 row(s) in 1.2840 seconds

    查看命名空间

    1. hbase(main):024:0> list_namespace
    2. NAMESPACE
    3. default
    4. hbase
    5. 2 row(s) in 0.0520 seconds

    创建命名空间

    1. hbase(main):025:0> create_namespace 'bigdata'
    2. 0 row(s) in 0.9040 seconds

    创建空间的表数据

    1. create 'bigdata:stu','info'
    2. 0 row(s) in 1.2770 seconds
    3. => Hbase::Table - bigdata:stu

    删除空间

    1. hbase(main):028:0> drop_namespace 'bigdata
    2. Here is some help for this command:
    3. Drop the named namespace. The namespace must be empty.
    4. hbase(main):030:0> disable 'bigdata:stu'
    5. 0 row(s) in 2.2480 seconds
    6. hbase(main):031:0> drop 'bigdata:stu'
    7. 0 row(s) in 1.2440 seconds
    8. hbase(main):032:0> drop_namespace 'bigdata'
    9. 0 row(s) in 0.8720 seconds