HBase-Shell-数据结构-原理

匿名 (未验证) 提交于 2019-12-02 23:40:02

3 HBase Shell

3.1

1HBase

[lxl@hadoop102 hbase]$ bin/hbase shell

2

hbase(main):001:0> help

3

hbase(main):001:0> list TABLE                                                                                                                                                                                                             0 row(s) in 0.2530 seconds  => []

3.2

1

hbase(main):003:0> create 'student','info' 0 row(s) in 1.3670 seconds  => Hbase::Table - student

2

hbase(main):003:0> put 'student','1001','info:sex','male' hbase(main):004:0> put 'student','1001','info:age','18' hbase(main):005:0> put 'student','1002','info:name','Janna' hbase(main):006:0> put 'student','1002','info:sex','female' hbase(main):007:0> put 'student','1002','info:age','20'

3

hbase(main):010:0>  scan 'student' ROW                                                   COLUMN+CELL                                                                                                                                                  1001                                                 column=info:name, timestamp=1560293882038, value=xiannv                                                                                                      1001                                                 column=info:sex, timestamp=1560293938473, value=female                                                                                                       1002                                                 column=info:name, timestamp=1560293958558, value=xiantong                                                                                                    1002                                                 column=info:sex, timestamp=1560293983958, value=male 

hbase(main):014:0> scan 'student',{STARTROW=>'1001',STOPROW=>'1003'} ROW                                                   COLUMN+CELL                                                                                                                                                  1001                                                 column=info:name, timestamp=1560293882038, value=xiannv                                                                                                      1001                                                 column=info:sex, timestamp=1560293938473, value=female                                                                                                       1002                                                 column=info:name, timestamp=1560293958558, value=xiantong                                                                                                    1002                                                 column=info:sex, timestamp=1560293983958, value=male  

hbase(main):015:0> scan 'student',{STARTROW => '1001'} ROW                                                   COLUMN+CELL                                                                                                                                                  1001                                                 column=info:name, timestamp=1560293882038, value=xiannv                                                                                                      1001                                                 column=info:sex, timestamp=1560293938473, value=female                                                                                                       1002                                                 column=info:name, timestamp=1560293958558, value=xiantong                                                                                                    1002                                                 column=info:sex, timestamp=1560293983958, value=male                                                                                                         1003                                                 column=info:sex, timestamp=1560294341536, value=male  

4

hbase(main):016:0> describe 'student' Table student is ENABLED                                                                                                                                                                                          student                                                                                                                                                                                                           COLUMN FAMILIES DESCRIPTION                                                                                                                                                                                       {NAME => 'info', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCA CHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}

5

hbase(main):012:0> put 'student','1001','info:name','Nick' hbase(main):013:0> put 'student','1001','info:age','100'

6:

hbase(main):011:0> get 'student','1001' COLUMN                                                CELL                                                                                                                                                         info:name                                            timestamp=1560293882038, value=xiannv                                                                                                                        info:sex                                             timestamp=1560293938473, value=female

hbase(main):012:0> get 'student','1001','info:name' COLUMN                                                CELL                                                                                                                                                         info:name                                            timestamp=1560293882038, value=xiannv 

7

hbase(main):021:0> count 'student'

8

rowkey

hbase(main):016:0> deleteall 'student','1001'

rowkey

hbase(main):017:0> delete 'student','1002','info:sex'

9

hbase(main):018:0> truncate 'student'

提示:disabletruncate

10

首先需要先让该表为disable

hbase(main):019:0> disable 'student'

drop

hbase(main):020:0> drop 'student'

dropERROR: Table student is enabled. Disable it first.

11

info3

hbase(main):022:0> alter 'student',{NAME=>'info',VERSIONS=>3} hbase(main):022:0> get 'student','1001',{COLUMN=>'info:name',VERSIONS=>3}

操作:

hbase(main):018:0> alter 'student', {NAME=>'info',VERSIONS=>3} Updating all regions with the new schema... 1/1 regions updated. Done. 0 row(s) in 1.9710 seconds  hbase(main):019:0> describe 'student' Table student is ENABLED                                                                                                                                                                                          student                                                                                                                                                                                                           COLUMN FAMILIES DESCRIPTION                                                                                                                                                                                       {NAME => 'info', BLOOMFILTER => 'ROW', VERSIONS => '3', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCA CHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}                                                                                                                                                    1 row(s) in 0.0150 seconds  hbase(main):020:0> put 'student','1001','info:name','guangshen' 0 row(s) in 0.0080 seconds  hbase(main):021:0> get 'student','1001','info:name' COLUMN                                                CELL                                                                                                                                                         info:name                                            timestamp=1560295375184, value=guangshen                                                                                                                    1 row(s) in 0.0170 seconds  hbase(main):022:0> get 'student','1001',{COLUMN=>'info:name',VERSIONS=>3} COLUMN                                                CELL                                                                                                                                                         info:name                                            timestamp=1560295375184, value=guangshen                                                                                                                     info:name                                            timestamp=1560293882038, value=xiannv                                                                                                                       1 row(s) in 0.0480 seconds  hbase(main):023:0> put 'student','1001','info:name','chunlei' 0 row(s) in 0.0080 seconds  hbase(main):024:0> get 'student','1001',{COLUMN=>'info:name',VERSIONS=>3} COLUMN                                                CELL                                                                                                                                                         info:name                                            timestamp=1560295467589, value=chunlei                                                                                                                       info:name                                            timestamp=1560295375184, value=guangshen                                                                                                                     info:name                                            timestamp=1560293882038, value=xiannv                                                                                                                       1 row(s) in 0.0090 seconds  hbase(main):025:0> put 'student','1001','info:name','wangjun' 0 row(s) in 0.0080 seconds  hbase(main):026:0> get 'student','1001',{COLUMN=>'info:name',VERSIONS=>3} COLUMN                                                CELL                                                                                                                                                         info:name                                            timestamp=1560295506023, value=wangjun                                                                                                                       info:name                                            timestamp=1560295467589, value=chunlei                                                                                                                       info:name                                            timestamp=1560295375184, value=guangshen                                                                                                                    1 row(s) in 0.0080 seconds

4 HBase

4.1 RowKey

nosql,RowKeyHBASE table

  1.RowKey访问

  2.RowKeyrange

  3.

  RowKey(RowKey)(64KB10-100bytes)HBASE

RowKeyRowKey(byte order)RowKey()

4.2 Column Family

HBASEschema()courses:historycourses:mathcourses

4.3 Cell

cell

关键字:无类型、字节码

4.4 Time Stamp

HBASE rowkeycolumnscellcell64HBASE()cell

()HBASEn

4.5 命名空间

:

1) Tabledefault

2) RegionServergroup

3) PermissionACLAccess Control List)。例如,创建表,读取表,删除,更新等等操作。

4) Quotaregion

5 HBase

5.1

HBase3

                                  3HBase

1Clientzookeepermetaregionmetametaregion

2namespacerowkeymetaregion

3regionregionserver

4region

5MemStoreBlockCache

6BlockCacheStoreFile()

7StoreFileBlockCache

5.2

Hbase2

                              

1ClientHregionServer

2HregionServerHLogwrite ahead log

3HregionServerMemStore

4Client

5.3Flush

1MemStore128M64MHLog

2HDFS

3HLog

5.4

14HmasterRegion

2256MRegionHregionServer

3HregionServerHregionServerhlogHregionServer.META.;

4HLogHDFS

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!