How describe Hbase column family?

2020-06-03 00:42发布

I am looking for a command which describes the columnfamily inside the table from the HBase Shell. I could not get any command to try this.

标签: hbase
3条回答
Luminary・发光体
2楼-- · 2020-06-03 01:23

There is no command to describe the Hbase column family (which can display the column qualifiers), but I used Hue Hbase Browser, it has a smartview, which can display column qualifiers of a column family.

(It can not show all the column qualifiers of column family( like describe), but it can show a record with all the column qualifiers, which is helpful for me to understand CF) (Something is better than nothing).

You can refer this link for more information: http://gethue.com/the-web-ui-for-hbase-hbase-browser/.

NOTE: Here is a sample page screenshot, showing column qualifiers of a Column Family ("p") enter image description here

If this is not helpful, you can write a Happy Script to display all the column qualifiers of a given Column Family, or you can use this API.

getFamilyMap public NavigableMap getFamilyMap(byte[] family)

Map of qualifiers to values. Returns a Map of the form: Map

Parameters:

family - column family to get

Returns: map of qualifiers to values

UPDATE #1

Recently I wrote a Java program to display the column family and column qualifiers of a hbase table. Remember, this program will do a full table scan and analyze every cell, to get the qualifier names.Might take very longer for larger tables.

Here is the link for the program.

查看更多
戒情不戒烟
3楼-- · 2020-06-03 01:31

If you use the describe command from the hbase shell you'll get the information for each column family. Currently, there is no way to filter on a single family.

Example:

hbase(main):003:0> describe 'TABLE_NAME'
 'TABLE_NAME',
 {NAME => 'FAMILY_NAME',
  DATA_BLOCK_ENCODING => 'NONE',
  BLOOMFILTER => 'ROW',
  REPLICATION_ true                                          
  SCOPE => '0',
  VERSIONS => '1',
  COMPRESSION => 'NONE',
  MIN_VERSIONS => '0', TTL => '2147483647',
  KEEP_DELETED_CELLS => 'false',
  BLOCKSIZE => '65536',
  IN_MEMORY => 'false',
  BLOCKCACHE => 'true'
 }   
查看更多
Fickle 薄情
4楼-- · 2020-06-03 01:39

I found this answer and added some modifications to it:

it list all column family for each Cqualifier
  echo "scan 'yourTable', {'LIMIT' => 1} " | $HBASE_HOME/bin/hbase shell | awk -F'=' '{print $2}' | awk -F ':' '{print $1}'|awk -F ',' '{print $1}'  
查看更多
登录 后发表回答