我对HBase的Shell命令工具的一些问题:HBase的Shell命令的问题
1: How to list all column family names (just names!) in a table?
2: How to count the number of rows in a column family?
我对HBase的Shell命令工具的一些问题:HBase的Shell命令的问题
1: How to list all column family names (just names!) in a table?
2: How to count the number of rows in a column family?
1:如何列出一个表中的所有列的姓氏(只是名称!)?
不可能OOTB。但是你可以做这样的事情:
echo "scan 'table'" | bin/hbase shell | awk -F'=' '{print $2}' | awk -F ':' '{print $1}'
2:如何计算行的一列的家庭有多少?
这是什么意思?您是否打算问如何计算行中列数的数量?如果这是你所需要的,试试这个:
echo "scan 'table'" | bin/hbase shell | grep cf | wc -l
我有一个基于塔里克的回答一个listColumns脚本,限制了扫描(因为我想它在我的有生之年完成)。
echo "scan '$1', LIMIT => 1" | hbase shell | awk '{print $2}' | grep column | sort | uniq | awk -F = '{print $2} '
显然你冒着行有不同列的风险。
使用describe
,它会显示在列族作为NAME=> 'columnfamilyname'
对于Q2:我想算一列族有多少行包含 – user2597504
上面的命令应该这样做。 – Tariq