@sasaki
2016-04-22T11:26:03.000000Z
字数 3159
阅读 2013
BigData
@Title Hbase——开源分布式数据库
@Version v1.0
@Timestamp 2016-01-22 14:18
@Author Nicholas
@Mail redskirt@outlook.com
基于HDFS和Zookeeper
[root@master ~]# hbase shell
16/01/27 11:00:10 INFO Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 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> list
TABLE mopishv3 table1
2 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 seconds
hbase(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 seconds
hbase(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 seconds
hbase(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
# put
hbase(main):045:0> put 'table2', "rowkey1", 'col1:test', "test01_value"
0 row(s) in 0.2160 seconds
# get
hbase(main):046:0> get 'table2', "rowkey1"
COLUMN CELL
col1:test timestamp=1453881130302, value=test01_value
1 row(s) in 0.0430 seconds
# scan