How can I dump hbase table in a text file?

前端 未结 2 1084
醉话见心
醉话见心 2021-01-19 05:01

I need to take a dump of one table in HBase and need it in a text file/csv format? I looked for scan, export and get commands in HBase

2条回答
  •  广开言路
    2021-01-19 05:24

    There are a lot of ways to get data out of an HBase table like running the export map/reduce job. You can read about this and other here http://blog.sematext.com/2011/03/11/hbase-backup-options/ If you want to control which rows/cells are written you can do that with pig scripts

    x = LOAD 'hbase://' USING org.apache.pig.backend.hadoop.hbase.HBaseStorage( '', '','-loadKey true') AS (ID: bytearray  , Value1:chararray , Value2:chararray);
    
    STORE x INTO ''
    USING CSVExcelStorage(['' [,{'YES_MULTILINE' | 'NO_MULTILINE'} [,{'UNIX' | 'WINDOWS' | 'UNCHANGED'}]]]);
    

提交回复
热议问题