在hbase中显示创建表

k2arahey  于 2021-06-09  发布在  Hbase
关注(0)|答案(1)|浏览(615)

是否有一个等效于Hive的: show create table <tablename>; 在hbase中?
我有几个定义了表拆分的表。使用描述 <tablename> 没有显示这个细节。
例如,如果我创建表test1,如下所示:

hbase(main):001:0> create 'TEST1', {NAME =>'D',COMPRESSION=>'SNAPPY'} , {SPLITS => ['1','2','3','4','5','6','7','8','9','0']}

hbase(main):001:0> describe 'TEST1'
DESCRIPTION                                                                                                                   ENABLED
 'TEST1', {NAME => 'D', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPR true
 ESSION => 'SNAPPY', MIN_VERSIONS => '0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'false', BLOCKSIZE => '65536', IN_MEMORY =>
  'false', BLOCKCACHE => 'true'}
1 row(s) in 6.5080 seconds

请注意,“描述”没有显示拆分。我怎样才能做到这一点,它显示分裂?
我知道我可以使用hbase主表详细信息网页查看此信息;但我需要在壳里看到这个。这样我就可以对几个表运行这个shell并查看拆分。

jdgnovmf

jdgnovmf1#

从hbase 1.4.0开始,您可以使用 list_regions 从shell获取此信息的命令。此命令由hbase-14925添加。

hbase(main):009:0> list_regions 'TEST1'
                      SERVER_NAME |                                             REGION_NAME |  START_KEY |    END_KEY |  SIZE |   REQ |   LOCALITY |
 -------------------------------- | ------------------------------------------------------- | ---------- | ---------- | ----- | ----- | ---------- |
 192.168.0.88,16020,1554497956619 |  TEST1,,1554323951962.89d0941894de38e0ae9341c8b6084d30. |            |          0 |     0 |     0 |        0.0 |
 192.168.0.88,16020,1554497956619 | TEST1,0,1554323951962.5a8ef486ce02f275b934f29a32420012. |          0 |          1 |     0 |     0 |        0.0 |
 192.168.0.88,16020,1554497956619 | TEST1,1,1554323951962.3db5376ce21369d512d78e5f1fff1bba. |          1 |          2 |     0 |     0 |        0.0 |
 192.168.0.88,16020,1554497956619 | TEST1,2,1554323951962.e1f0c483458599d7dcd0ed5d30003545. |          2 |          3 |     0 |     0 |        0.0 |
 192.168.0.88,16020,1554497956619 | TEST1,3,1554323951962.15647aa5d5e171221e6b83df6b657601. |          3 |          4 |     0 |     0 |        0.0 |
 192.168.0.88,16020,1554497956619 | TEST1,4,1554323951962.54d28b093d7061067bd51df94f0461bf. |          4 |          5 |     0 |     0 |        0.0 |
 192.168.0.88,16020,1554497956619 | TEST1,5,1554323951962.c3a88c6e5ad002f742b7673a3603846a. |          5 |          6 |     0 |     0 |        0.0 |
 192.168.0.88,16020,1554497956619 | TEST1,6,1554323951962.92e954f21167a38914a127564af6d1b0. |          6 |          7 |     0 |     0 |        0.0 |
 192.168.0.88,16020,1554497956619 | TEST1,7,1554323951962.689cfe19e275404643e3e76d2931c846. |          7 |          8 |     0 |     0 |        0.0 |
 192.168.0.88,16020,1554497956619 | TEST1,8,1554323951962.14d0ed9c3f50c107259c44ce8d0fb1a3. |          8 |          9 |     0 |     0 |        0.0 |
 192.168.0.88,16020,1554497956619 | TEST1,9,1554323951962.81c6d967c6c38590bb16a276f0cf8b55. |          9 |            |     0 |     0 |        0.0 |
 11 rows
Took 0.0410 seconds

要获取早期版本的区域,您需要从 hbase:meta table。相关部分是 STARTKEY 以及 ENDKEY .

hbase(main):016:0> scan 'hbase:meta', { FILTER => "PrefixFilter('TEST1')", COLUMNS => "info:regioninfo" }
ROW                                       COLUMN+CELL                                                                                                           
 TEST1,,1554323951962.89d0941894de38e0ae9 column=info:regioninfo, timestamp=1554499886995, value={ENCODED => 89d0941894de38e0ae9341c8b6084d30, NAME => 'TEST1,,1
 341c8b6084d30.                           554323951962.89d0941894de38e0ae9341c8b6084d30.', STARTKEY => '', ENDKEY => '0'}                                       
 TEST1,0,1554323951962.5a8ef486ce02f275b9 column=info:regioninfo, timestamp=1554499887022, value={ENCODED => 5a8ef486ce02f275b934f29a32420012, NAME => 'TEST1,0,
 34f29a32420012.                          1554323951962.5a8ef486ce02f275b934f29a32420012.', STARTKEY => '0', ENDKEY => '1'}                                     
 TEST1,1,1554323951962.3db5376ce21369d512 column=info:regioninfo, timestamp=1554499886995, value={ENCODED => 3db5376ce21369d512d78e5f1fff1bba, NAME => 'TEST1,1,
 d78e5f1fff1bba.                          1554323951962.3db5376ce21369d512d78e5f1fff1bba.', STARTKEY => '1', ENDKEY => '2'}                                     
 TEST1,2,1554323951962.e1f0c483458599d7dc column=info:regioninfo, timestamp=1554499887010, value={ENCODED => e1f0c483458599d7dcd0ed5d30003545, NAME => 'TEST1,2,
 d0ed5d30003545.                          1554323951962.e1f0c483458599d7dcd0ed5d30003545.', STARTKEY => '2', ENDKEY => '3'}                                     
 TEST1,3,1554323951962.15647aa5d5e171221e column=info:regioninfo, timestamp=1554499886982, value={ENCODED => 15647aa5d5e171221e6b83df6b657601, NAME => 'TEST1,3,
 6b83df6b657601.                          1554323951962.15647aa5d5e171221e6b83df6b657601.', STARTKEY => '3', ENDKEY => '4'}                                     
 TEST1,4,1554323951962.54d28b093d7061067b column=info:regioninfo, timestamp=1554499886982, value={ENCODED => 54d28b093d7061067bd51df94f0461bf, NAME => 'TEST1,4,
 d51df94f0461bf.                          1554323951962.54d28b093d7061067bd51df94f0461bf.', STARTKEY => '4', ENDKEY => '5'}                                     
 TEST1,5,1554323951962.c3a88c6e5ad002f742 column=info:regioninfo, timestamp=1554499887008, value={ENCODED => c3a88c6e5ad002f742b7673a3603846a, NAME => 'TEST1,5,
 b7673a3603846a.                          1554323951962.c3a88c6e5ad002f742b7673a3603846a.', STARTKEY => '5', ENDKEY => '6'}                                     
 TEST1,6,1554323951962.92e954f21167a38914 column=info:regioninfo, timestamp=1554499886980, value={ENCODED => 92e954f21167a38914a127564af6d1b0, NAME => 'TEST1,6,
 a127564af6d1b0.                          1554323951962.92e954f21167a38914a127564af6d1b0.', STARTKEY => '6', ENDKEY => '7'}                                     
 TEST1,7,1554323951962.689cfe19e275404643 column=info:regioninfo, timestamp=1554499887009, value={ENCODED => 689cfe19e275404643e3e76d2931c846, NAME => 'TEST1,7,
 e3e76d2931c846.                          1554323951962.689cfe19e275404643e3e76d2931c846.', STARTKEY => '7', ENDKEY => '8'}                                     
 TEST1,8,1554323951962.14d0ed9c3f50c10725 column=info:regioninfo, timestamp=1554499887020, value={ENCODED => 14d0ed9c3f50c107259c44ce8d0fb1a3, NAME => 'TEST1,8,
 9c44ce8d0fb1a3.                          1554323951962.14d0ed9c3f50c107259c44ce8d0fb1a3.', STARTKEY => '8', ENDKEY => '9'}                                     
 TEST1,9,1554323951962.81c6d967c6c38590bb column=info:regioninfo, timestamp=1554499886995, value={ENCODED => 81c6d967c6c38590bb16a276f0cf8b55, NAME => 'TEST1,9,
 16a276f0cf8b55.                          1554323951962.81c6d967c6c38590bb16a276f0cf8b55.', STARTKEY => '9', ENDKEY => ''}                                      
11 row(s)
Took 0.0134 seconds

相关问题