【问题标题】:How do I get a Row with HBASE Shell where the rowkey is in Hexadecimal?如何使用 HBASE Shell 获得行键为十六进制的行?
【发布时间】:2013-09-17 13:55:20
【问题描述】:

如果我有一个十六进制的行键,例如 x00\x01 ,我如何在 HBASE shell 中 get

hbase(main):004:0> scan 'tsdb-tree'
ROW                 COLUMN+CELL
\x00\x01            column=t:tree, timestamp=1379421652764, value={"name":"...

【问题讨论】:

    标签: hbase hbase-shell


    【解决方案1】:

    您可以使用普通的get 命令引用它,但是十六进制键必须用双引号,单引号不起作用:

    例如你会使用get 'tsdb-tree', "\x00\x01":

    hbase(main):016:0> scan 'tsdb-tree'
    ROW                                                                       COLUMN+CELL                                                                                                                                                                                                             
     \x00\x01                                                                 column=t:tree, timestamp=1379421652764, value={"name":"TestTree1","description":"","notes":"","strictMatch":false,"created":0,"enabled":false,"storeFailures":false}                                                    
     \x00\x01                                                                 column=t:tree_rule:0:0, timestamp=1379371753132, value={"type":"METRIC","field":"host","regex":"","separator":"","description":"","notes":"","level":0,"order":0,"treeId":1,"customField":"","regexGroupIdx":0,"displayF
                                                                              ormat":""}                                                                                                                                                                                                              
     \x00\x02                                                                 column=t:tree, timestamp=1379372909057, value={"name":"testTree2","description":"","notes":"","strictMatch":false,"created":0,"enabled":false,"storeFailures":false}                                                    
    2 row(s) in 0.0300 seconds
    
    hbase(main):017:0> get 'tsdb-tree', "\x00\x01"
    COLUMN                                                                    CELL                                                                                                                                                                                                                    
     t:tree                                                                   timestamp=1379421652764, value={"name":"TestTree1","description":"","notes":"","strictMatch":false,"created":0,"enabled":false,"storeFailures":false}                                                                   
     t:tree_rule:0:0                                                          timestamp=1379371753132, value={"type":"METRIC","field":"host","regex":"","separator":"","description":"","notes":"","level":0,"order":0,"treeId":1,"customField":"","regexGroupIdx":0,"displayFormat":""}              
    2 row(s) in 0.0140 seconds
    

    【讨论】:

    • 有时你的十六进制行键会包含一个'"'。即)\x93\x83\x5C\xD0\xD5B\xC4\x83q\xD3z\x17"\xC1\xFF只需用'\'转义里面的双引号,即)\x93\x83\x5C\xD0\xD5B\xC4\x83q\xD3z\x17\"\xC1\xFF
    • 有没有办法在 Java 中实现这一点。我在这里@@stackoverflow.com/questions/57391102/… 尝试过,但仍在试图弄清楚如何做到这一点。
    猜你喜欢
    • 1970-01-01
    • 2014-08-16
    • 2018-10-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-24
    • 2021-12-22
    • 2016-06-06
    相关资源
    最近更新 更多