简体   繁体   English

在HBase中使用多个行键过滤器扫描表

[英]Scan table with multiple rowkey filter in hbase

I have tried with single row-key ,its working fine but i am unable to fetch multiple row-key scan. 我已经尝试过单个行键,它的工作正常,但我无法获取多个行键扫描。

scan 'LPV',{FILTER =>"(PrefixFilter('174','194')"}

getting error,find Filter to support scan multiple row key ranges but didnt find is it possible or not ? 收到错误消息,找到过滤器以支持扫描多个行键范围,但未找到是否可能? I want to fetch multiple records based on multiple row-keys. 我想基于多个行键获取多个记录。 Any help,Thanks. 任何帮助,谢谢。

您只需要两个OR PrefixFilters或

scan 'LPV',{FILTER =>"(PrefixFilter('174') OR PrefixFilter('194')"}

I am not sure there is a solution in Hbase shell for multiple prefix filter. 我不确定Hbase Shell中是否有针对多个前缀过滤器的解决方案。 But you can write a script to do multiple prefixfilter one by one. 但是您可以编写一个脚本来一个接一个地执行多个前缀过滤。 for example put your key prefixes to a file a1.txt line by line; 例如,将您的密钥前缀逐行放置到文件a1.txt中;

a1.txt
-------
pref1
pref2
pref3

then run a script like (i am not good at shell scripting. you can do better) 然后运行以下脚本(我不擅长shell脚本。您可以做得更好)

cat a1.txt | while read LINE; do echo "scan 'LPV',{FILTER=>\"PrefixFilter('$LINE')\"} " | hbase shell;done

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM