HBase数据导入导出(export|HBase数据导入导出(export import)
2019独角兽企业重金招聘Python工程师标准>>>
文章图片
1.export
1> 执行导出命令
可使用-D命令自定义参数,此处限定表名、列族、开始结束RowKey、以及导出到HDFS的目录
hbase org.apache.hadoop.hbase.mapreduce.Export -D hbase.mapreduce.scan.column.family=0 -D hbase.mapreduce.scan.row.start=aaaaaaaaaaaaaaaaaaa00010078 -D hbase.mapreduce.scan.row.stop=jjjjjjjjjjjjjjjjjjj00010078 TESTA /tmp/hbase_export
可选的-D参数配置项
Usage: Export [-D ]* [ [ []] [^[regex pattern] or [Prefix] to filter]]Note: -D properties will be applied to the conf used.
For example:
-D mapred.output.compress=true
-D mapred.output.compression.codec=org.apache.hadoop.io.compress.GzipCodec
-D mapred.output.compression.type=BLOCK
Additionally, the following SCAN properties can be specified
to control/limit what is exported..
-D hbase.mapreduce.scan.column.family=
-D hbase.mapreduce.include.deleted.rows=true
For performance consider the following properties:
-Dhbase.client.scanner.caching=100
-Dmapred.map.tasks.speculative.execution=false
-Dmapred.reduce.tasks.speculative.execution=false
For tables with very wide rows consider setting the batch size as below:
-Dhbase.export.scanner.batch=10
2> MR执行导出

文章图片
3> 查看HDFS

文章图片
2.import
1> 预先建表
在hbase中预先建立一个名称为TESTX的表,其包含一个名称为0的列族。若表事先不存在将报错
create 'TESTX','0'

文章图片
2> 运行导入命令
可使用-D命令自定义参数,此处不多做限制
hbase org.apache.hadoop.hbase.mapreduce.Import TESTX hdfs://cdh01/tmp/hbase_export/
可选的-D参数配置项
Usage: Import [options] By default Import will load data directly into HBase. To instead generate
HFiles of data to prepare for a bulk data load, pass the option:
-Dimport.bulk.output=/path/for/output
To apply a generic org.apache.hadoop.hbase.filter.Filter to the input, use
-Dimport.filter.class=
-Dimport.filter.args=
3> MR执行导入

文章图片
4> HBase查看导入数据

文章图片
【HBase数据导入导出(export|HBase数据导入导出(export import)】转载于:https://my.oschina.net/puwenchao/blog/1933186
推荐阅读
- Docker应用:容器间通信与Mariadb数据库主从复制
- 使用协程爬取网页,计算网页数据大小
- Java|Java基础——数组
- Python数据分析(一)(Matplotlib使用)
- Jsr303做前端数据校验
- Spark|Spark 数据倾斜及其解决方案
- 数据库设计与优化
- 爬虫数据处理HTML转义字符
- 数据库总结语句
- 没有导入future这个module