You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Karan Mehta (JIRA)" <ji...@apache.org> on 2017/04/04 02:25:42 UTC
[jira] [Commented] (HBASE-14925) Develop HBase shell command/tool
to list table's region info through command line
[ 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]
{code}
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
begin
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}"
end
end
ensure
hregion_locator_instance.close()
end
{code}
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
(v6.3.15#6346)