-
-
Save sankars/07d209879f4c6c154740c8eb41a7f801 to your computer and use it in GitHub Desktop.
Print tables having more than one region
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include Java | |
import org.apache.hadoop.hbase.HBaseConfiguration | |
import org.apache.hadoop.hbase.client.HBaseAdmin | |
import org.apache.hadoop.hbase.client.HTable | |
import org.apache.hadoop.hbase.util.Bytes | |
conf = HBaseConfiguration.create() | |
admin = HBaseAdmin.new(conf) | |
tables = admin.listTables() | |
table_regioncounts = {} | |
tables.each do |t| | |
table_name = Bytes.toString(t.getName()) | |
table_handle = HTable.new(conf, table_name) | |
regions = table_handle.getRegionsInfo() | |
if regions.size > 1 | |
table_regioncounts[table_name] = regions.size | |
end | |
table_handle.close | |
end | |
puts table_regioncounts.inspect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment