我想在Hbase中获取元数据信息.我的基本目的是-
1.get the information about tables like how many tables and name of tables.
2.get the columnfamilies name in each table.
3.get the columns names and their data types in each columnfamily.
Is there any tool or command by using which we can get the above
information ??
解决方法:
通过API:
>使用HBaseAdmin类提供的getTableNames().它返回一个字符串数组,其中包含所有用户空间表的名称.
>使用结果类提供的getMap().它将族的映射返回到其限定符和值的所有版本.您可以从中提取所需的信息.
>可以通过getMap()实现.就数据类型而言,HBase中的所有内容都是字节数组.
通过外壳:
没有OOTB功能允许这样做,但是您可以将HBase命令与awk结合使用来快速实现:
例如 :
List table names and the count : echo “scan ‘demo'” | bin/hbase shell
| awk -F” ” ‘{print$1}’Get all the CFs : echo “scan ‘test1′” | bin/hbase shell | awk -F”=”
‘{print$2}’ | awk -F”:” ‘{print $1}’Get all the columns : echo “scan ‘demo'” | bin/hbase shell | awk -F”=” ‘{print$2}’ | awk -F”,” ‘{print$1}’ | awk -F”:” ‘{print$2}’
高温超导
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。