hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karan Mehta (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-14925) Develop HBase shell command/tool to list table's region info through command line
Date Tue, 04 Apr 2017 02:25:42 GMT

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

Karan Mehta commented on HBASE-14925:

[~ashish singhi]

      def command(table_name, region_server_name = "")
        admin_instance = admin.instance_variable_get("@admin")
        conn_instance = admin_instance.getConnection()
        cluster_status = admin_instance.getClusterStatus()
        hregion_locator_instance = conn_instance.getRegionLocator(TableName.valueOf(table_name))
        list = hregion_locator_instance.getAllRegionLocations()
        results = Array.new
          list.each do |hregion|
            if hregion.getServerName().toString.start_with? region_server_name
              startKey = Bytes.toString(hregion.getRegionInfo().getStartKey())
              endKey = Bytes.toString(hregion.getRegionInfo().getEndKey())
              puts "All = #{hregion} , Start = #{startKey}, End = #{endKey}"

How does this code seem? It filters the regions by user provided {{Server Name}} as prefix.

> 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
>            Assignee: Karan Mehta
>         Attachments: HBASE-14925.patch
> 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