Is there an equivalent to hive: show create table <tablename>;
in hbase?
I have several tables with table splits defined. using Describe <tablename>
doesn't show this detail.
For example, if I create table TEST1 like:
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
Notice that the describe doesn't show the splits. How can I do this in a way that it shows the splits?
I understand that I can see this info using HBase master table detail webpage; but I need to see this in the shell. That way I can run this shell for several tables and see the splits.
Starting from HBase 1.4.0 you can use list_regions
command from shell to get this information. This command was added by 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
To get the regions on an earlier version you'd need to collect it from hbase:meta
table. The relevant parts are STARTKEY
and 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With