HBase创建表参数说明

HBase创建表参数


创建dimensoft namespace

> create_namespace 'dimensoft'

注:这里的namespace类似与RDBMS中的数据库的概念。

创建user表

> create 'dimensoft:user', 'info'

查看表结构

> describe 'dimensoft:user'

在使用最简单的建表语句后HBase会给一些参数设置默认值,这些参数都是针对的列族而言,如果一个表有多个列族则每个列族都会有一份如下的参数:

DESCRIPTION
 'dimensoft:user', //namespace:tableName
    {
        NAME => 'info', //列族

        DATA_BLOCK_ENCODING => 'NONE', //数据块编码方式设置
        //参见:http://hbase.apache.org/book.html#data.block.encoding.enable

        BLOOMFILT => 'ROW', //参见:http://hbase.apache.org/book.html#bloom.filters.when

        REPLICATION_SCOPE => '0', //配置HBase集群replication时需要将该参数设置为1.

        //参见:http://blog.cloudera.com/blog/2012/08/hbase-replication-operational-overview/?utm_source=tuicool
        'REPLICATION_SCOPE is a column-family level attribute 
user has to alter each column family with the alter command as 
shown above, for all the column families he wants to replicate.'

        VERSIONS => '1', //设置保存的版本数

        COMPRESSION => 'NONE', //设置压缩算法

        MIN_VERSIONS => '0', //最小存储版本数

        TTL => 'FOREVER', //参见:http://hbase.apache.org/book.html#ttl
        'ColumnFamilies can set a TTL length in seconds, and HBase 
reached. This applies to all versions of a row - even the current one. 
The TTL time encoded in the HBase for the row is specified in 
UTC.'

        KEEP_DELETED_CELLS => 'false', //参见:http://hbase.apache.org/book.html#cf.keep.deleted

        BLOCKSIZE => '65536', //设置HFile数据块大小(默认64kb)

        IN_MEMORY => 'false',//设置激进缓存,优先考虑将该列族放入块缓存中,
                             //针对随机读操作相对较多的列族可以设置该属性为true

        BLOCKCACHE => 'true' //数据块缓存属性
    }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章