hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "stack (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-14925) Develop HBase shell command/tool to list table's region info through command line
Date Fri, 04 Dec 2015 18:49:11 GMT

    [ https://issues.apache.org/jira/browse/HBASE-14925?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15041969#comment-15041969

stack commented on HBASE-14925:

Just some notes... yeah, would be good to have a nice dump of regions by table. How to format
output will be an issue. Need to do escaping if binary data as we do in the shell currently.
Unfortunately while you can do 'm  = get_table('hbase:meta')' and then 'm.scan...', we've
not done the work so you can do 'for result in m.scan....' so you could loop the results in
the shell and format them however you wish.

Here is some ugly hack that gets the wanted cells from hbase:meta and then cuts up the emission
into a form perhaps digestible in shell (have to handle the empty row that demarks start and
stop of a table...)

 echo "scan 'hbase:meta', {ROWPREFIXFILTER => 't2,', COLUMNS => ['info:server', 'info:regioninfo']"}
| ./bin/hbase shell|sed -e 's/^.*value=//'|paste -d " " - -|sed -e "s/^.*NAME => '//" -e
"s/', STARTKEY => '/ /" -e "s/', ENDKEY => '/ /" -e "s/'} / /"

...where 't2' in above is the tablename, would get you:

t2,a,1449181637707.cf2b5d8caa5a0a44d7f0b48273abb53e. a b localhost:61767
t2,b,1449181637707.80686f6b985b23885e06416ced5e9e1b. b c localhost:61767
t2,c,1449181637707.4c8237c47d72de053f1b8e50a28dd223. c d localhost:61767
t2,d,1449181637707.a5f1b474563b6d4ee2cabbd75d2ffd1e. d e localhost:61767
t2,e,1449181637707.14f09d26e6d98498473483ee479b0e61. e f localhost:61767
t2,f,1449181637707.a37b71a65c6a6395ffdf4af57d69382a. f  localhost:61767

... but all is quoted and it needs more edit to get clean list.

Doing this in shell, you are getting the toStringBinary... which does escaping which may or
may not be wanted by the issue filer.

The shell is ruby so you could write a few lines to format however.

> Develop HBase shell command/tool to list table's region info through command line
> ---------------------------------------------------------------------------------
>                 Key: HBASE-14925
>                 URL: https://issues.apache.org/jira/browse/HBASE-14925
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Romil Choksi
> I am going through the hbase shell commands to see if there is anything I can use to
get all the regions info just for a particular table. I don’t see any such command that
provides me that information.
> It would be better to have a command that provides region info, start key, end key etc
taking a table name as the input parameter. This is available through HBase UI on clicking
on a particular table's link
> A tool/shell command to get a list of regions for a table or all tables in a tabular
structured output (that is machine readable)

This message was sent by Atlassian JIRA

View raw message