@sasaki
2016-04-22T03:26:03.000000Z
字数 3159
阅读 2239
BigData
@Title Hbase——开源分布式数据库@Version v1.0@Timestamp 2016-01-22 14:18@Author Nicholas@Mail redskirt@outlook.com
基于HDFS和Zookeeper
[root@master ~]# hbase shell16/01/27 11:00:10 INFO Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.availableHBase Shell; enter 'help<RETURN>' for list of supported commands.Type "exit<RETURN>" to leave the HBase ShellVersion 0.98.6-cdh5.3.8, rUnknown, Wed Oct 14 17:29:57 PDT 2015# 创建表hbase(main):015:0* create 'table1', 'fml'0 row(s) in 1.1840 seconds=> Hbase::Table - table1# 查看表hbase(main):016:0> listTABLE mopishv3 table12 row(s) in 0.0090 seconds=> ["mopishv3", "table1"]# 查看表结构hbase(main):017:0> describe 'table1'DESCRIPTION ENABLED'table1', {NAME => 'fml', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLIC true ATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'false', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'} 1 row(s) in 0.0310 seconds# 修改列属性hbase(main):005:0> alter 'table1', NAME => 'fml', BLOOMFILTER => 'NONE'Updating all regions with the new schema...0/1 regions updated.1/1 regions updated.Done.0 row(s) in 2.2390 secondshbase(main):006:0> describe 'table1'DESCRIPTION ENABLED'table1', {NAME => 'fml', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'NONE', REPLI true CATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'false', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}1 row(s) in 0.0270 seconds# 定义表属性hbase(main):014:0> alter 'table1', MAX_FILESIZE => '134217728'Updating all regions with the new schema...0/1 regions updated.1/1 regions updated.Done.0 row(s) in 2.1780 secondshbase(main):016:0> describe 'table1'DESCRIPTION ENABLED'table1', {TABLE_ATTRIBUTES => {MAX_FILESIZE => '134217728'}, {NAME => 'fml', DATA_BL true OCK_ENCODING => 'NONE', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'false', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}1 row(s) in 0.0280 seconds# 删除表属性hbase(main):018:0* alter 'table1', METHOD => 'table_att_unset', NAME => 'MAX_FILESIZE'Updating all regions with the new schema...0/1 regions updated.1/1 regions updated.Done.0 row(s) in 2.1390 seconds# 添加列族hbase(main):023:0> alter 'table1', NAME=>'fml2'Updating all regions with the new schema...0/1 regions updated.1/1 regions updated.Done.0 row(s) in 2.1720 seconds# 删除列族hbase(main):024:0> alter 'table1', METHOD=>'delete', NAME=>'fml2'Updating all regions with the new schema...0/1 regions updated.1/1 regions updated.Done.0 row(s) in 2.1810 seconds# 停止表服务hbase(main):029:0> disable 'table1'0 row(s) in 1.3050 secondshbase(main):030:0> describe 'table1'DESCRIPTION ENABLED'table1', {NAME => 'fml', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'NONE', REPLI false CATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'false', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}1 row(s) in 0.0380 seconds# 删除表hbase(main):031:0> drop 'table1'0 row(s) in 0.1990 seconds
# puthbase(main):045:0> put 'table2', "rowkey1", 'col1:test', "test01_value"0 row(s) in 0.2160 seconds# gethbase(main):046:0> get 'table2', "rowkey1"COLUMN CELLcol1:test timestamp=1453881130302, value=test01_value1 row(s) in 0.0430 seconds# scan