我需要一个搜索hbase内容的帮助。我有一个hbase表'tblsearch'。
如何查看表模式(例如,在mysql中显示create table tbl\u name)?如何查看“tblsearch”表的所有内容,其中ali value=24146,其中date='2014-02-08'
hbase(main):026:0> describe 'tblsearch'
DESCRIPTION ENABLED
{NAME => 'tblsearch', FAMILIES => [{NAME => 'd', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'NON true
E', REPLICATION_SCOPE => '0', VERSIONS => '3', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => '-
1', KEEP_DELETED_CELLS => 'false', BLOCKSIZE => '65536', IN_MEMORY => 'false', ENCODE_ON_DISK => 'tr
ue', BLOCKCACHE => 'false'}]}
1 row(s) in 0.1040 seconds
Scanning 5 rows from the table:
hbase(main):023:0> scan 'tblsearch', {'LIMIT'=>5}
ROW COLUMN+CELL
a24146_1371760717_J=K\xF6 column=d:ali, timestamp=1379351295242, value=24146
a24146_1371760717_J=K\xF6 column=d:level, timestamp=1379351295242, value=yellow
a24146_1371760717_J=K\xF6 column=d:message_template, timestamp=1379351295242, value=ALI {ali} has no user priority value
a24146_1371760717_\xE1\xF7\x01\x0F column=d:ali, timestamp=1379351295243, value=24146
a24146_1371760717_\xE1\xF7\x01\x0F column=d:level, timestamp=1379351295243, value=yellow
a24146_1371760717_\xE1\xF7\x01\x0F column=d:message_template, timestamp=1379351295243, value=ALI {ali} has no user weight vector
a24146_1371760724_\x08\x18\xC20 column=d:ali, timestamp=1379351295243, value=24146
a24146_1371760724_\x08\x18\xC20 column=d:level, timestamp=1379351295243, value=green
a24146_1371760724_\x08\x18\xC20 column=d:message_template, timestamp=1379351295243, value=ALI {ali} has been successfully allocated
a24146_1371817802_X\xD4`\x8A column=d:ali, timestamp=1379351295361, value=24146
a24146_1371817802_X\xD4`\x8A column=d:level, timestamp=1379351295361, value=yellow
a24146_1371817802_X\xD4`\x8A column=d:message_template, timestamp=1379351295361, value=ALI {ali} has no user priority value
a24146_1371817802_\xD97\xBBe column=d:ali, timestamp=1379351295362, value=24146
a24146_1371817802_\xD97\xBBe column=d:level, timestamp=1379351295362, value=yellow
a24146_1371817802_\xD97\xBBe column=d:message_template, timestamp=1379351295362, value=ALI {ali} has no user weight vector
3条答案
按热度按时间8zzbczxx1#
我在这里看不到任何列作为日期。但是你可以通过hbase过滤器来实现。例如,如果要获取ali=24146的所有行,可以执行以下操作:
hbase(main):001:0>导入org.apache.hadoop.hbase.util.bytes
hbase(main):002:0>导入org.apache.hadoop.hbase.filter.singlecolumnvaluefilter
hbase(main):003:0>导入org.apache.hadoop.hbase.filter.binarycomparator
hbase(main):004:0>导入org.apache.hadoop.hbase.filter.comparefilter
hbase(main):005:0>扫描“tblsearch”,{filter=>singlecolumnvaluefilter.new(bytes.tobytes('d'),bytes.tobytes('ali'),comparefilter::compareop.valueof('equal'),binarycomparator.new(bytes.tobytes('24146'))}
hth公司
u0sqgete2#
您可以在hbase shell中使用以下命令。不需要导入,在0.94.6中对我有效
bttbmeg03#
您可以看到表“tblsearch”的所有内容,其中ali value=24146,其中date='2014-02-08'基于在表中放入记录时定义或使用的“tblsearch”表的rowkey。