上QQ阅读APP看书,第一时间看更新
2.4.5 使用describe命令
通过list命令只是查询到了数据库中所有的表名称,但是如果需要表中的详细信息,则需要使用describe命令。
范例如下:
hbase(main):001:0> describe ERROR: wrong number of arguments (0 for 1) Here is some help for this command: Describe the named table. For example: hbase> describe 't1' hbase> describe 'ns1:t1' Alternatively, you can use the abbreviated 'desc' for the same thing. hbase> desc 't1' hbase> desc 'ns1:t1'
从上述信息可知,我们输入的命令有错误。
正确的操作命令如下:
hbase(main):001:0> describe 'test' Table test is DISABLED test COLUMN FAMILIES DESCRIPTION {NAME => 'cf2', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS =>'0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'} {NAME => 'cf1', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS =>'0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'} 2 row(s) in 0.3490 seconds
命令解析:查询表名为student的详细信息。需要注意的是,name表示的是列族的名称而不是列的名称。从上面信息中可知,此表student中包含了两个列族,分别是cf1和cf2。