zoukankan      html  css  js  c++  java
  • hbase命名空间

    在HBase中,namespace命名空间指对一组表的逻辑分组,类似于数据库,便于对表在业务上划分

    HBase系统默认定义了两个缺省的namespace
    • hbase:系统内建表,包括namespace和meta表
    • default:用户建表时未指定namespace的表都创建在此

    hbase(main):224:0> list_namespace
    NAMESPACE                                                                                                                                                                       
    default                                                                                                                                                                         
    hbase                                                                                                                                                                           
    2 row(s)
    Took 0.2533 seconds

    hbase(main):223:0> help "namespace"

    Command: alter_namespace Alter namespace properties.

    To add/modify a property:

      hbase> alter_namespace 'ns1', {METHOD => 'set', 'PROPERTY_NAME' => 'PROPERTY_VALUE'}

    To delete a property:

      hbase> alter_namespace 'ns1', {METHOD => 'unset', NAME=>'PROPERTY_NAME'}

    Command: create_namespace Create namespace; pass namespace name, and optionally a dictionary of namespace configuration. Examples:

      hbase> create_namespace 'ns1'   hbase> create_namespace 'ns1', {'PROPERTY_NAME'=>'PROPERTY_VALUE'}

    Command: describe_namespace Describe the named namespace. For example:   hbase> describe_namespace 'ns1'

    Command: drop_namespace Drop the named namespace. The namespace must be empty.

    Command: list_namespace List all namespaces in hbase. Optional regular expression parameter could be used to filter the output. Examples:

      hbase> list_namespace   hbase> list_namespace 'abc.*'

    Command: list_namespace_tables List all tables that are members of the namespace. Examples:

      hbase> list_namespace_tables 'ns1'

    创建命名空间

    hbase(main):226:0> create_namespace 'testdb'
    Took 2.1094 seconds    

    列出所有命名空间                                                                                                                                                         
    hbase(main):227:0> list_namespace
    NAMESPACE                                                                                                                                                                       
    default                                                                                                                                                                         
    hbase                                                                                                                                                                           
    testdb                                                                                                                                                                          
    3 row(s)
    Took 0.0217 seconds

    在namespace创建表

    hbase(main):229:0> create 'testdb:mytable','basicinfo'
    Created table testdb:mytable
    Took 2.3445 seconds                                                                                                                                                             
    => Hbase::Table - testdb:mytable

    查看命名空间下的表

    hbase(main):238:0> list_namespace_tables 'testdb'
    TABLE                                                                                                                                                                           
    mytable                                                                                                                                                                         
    1 row(s)
    Took 0.0139 seconds                                                                                                                                                             
    => ["mytable"]

    删除命名空间

    hbase(main):239:0> drop_namespace 'testdb'

    ERROR: org.apache.hadoop.hbase.constraint.ConstraintException: Only empty namespaces can be removed. Namespace testdb has 1 tables

    提示只有空的命名空间可以删除,删除命名空间前。需要先删除命名空间的表

    hbase(main):241:0> disable 'testdb:mytable'
    Took 0.7931 seconds                                                                                                                                                             
    hbase(main):242:0> drop 'testdb:mytable'
    Took 0.9203 seconds                                                                                                                                                             
    hbase(main):243:0> drop_namespace 'testdb'
    Took 0.5726 seconds

  • 相关阅读:
    Monkey脚本编写
    monkey基础知识(二)
    monkey基础知识(一)
    全蛋蛋糕做法
    超乎想象的酥脆香甜---杏仁薄饼
    uiautomator——第一个例子:打开浏览器,输入网址
    uiautomator环境搭建
    如何通过外部表做数据一致性检查和配平
    如何在Elasticsearch中删除中文索引
    Elasticsearch SQL特性研究
  • 原文地址:https://www.cnblogs.com/playforever/p/9073246.html
Copyright © 2011-2022 走看看