Datax:阿里云hbase数据导入到自建hbase集群
1、安装datax3.0
http://datax-opensource.oss-cn-hangzhou.aliyuncs.com/datax.tar.gz
2、部署主机
主机:node2
路径:/data1/xinsrv/datax
JDK:1.8
Python:2.6
3、下载alihbase-Connector
4、拷贝到hbase目录
cp alihbase-connector-1.0.11.jar /data1/xinsrv/datax/plugin/reader/hbase11xreader/libs/
5、任务执行
/data1/xinsrv/datax/bin/datax.py /data1/xinsrv/datax/job/alihbase2hbase.json
6、样例2(从阿里云hbase读取数据然后写入到本地hbase)
cat alihbase2hbase.json
{
"job": {
"setting": {
"speed": {
"channel": 1
}
},
"content": [
{
"reader": {
"name": "hbase11xreader",
"parameter": {
"hbaseConfig": {
"hbase.client.connection.impl" : "com.alibaba.hbase.client.AliHBaseUEConnection",
"hbase.client.endpoint" : "proxy-hbaseue.hbaseue.rds.aliyuncs.com:30020",
"hbase.client.username" : "root",
"hbase.client.password" : "password"
},
"table": "test:user_level",
"encoding": "utf-8",
"mode": "normal",
"column": [
{
"name": "rowkey",
"type": "string"
},
{
"name": "a:oc",
"type": "string"
},
{
"name": "a:ol",
"type": "string",
},
{
"name": "a:nc",
"type": "string"
},
{
"name": "a:nl",
"type": "string"
},
{
"name": "a:ts",
"type": "string"
},
{
"name": "a:cid",
"type": "string"
},
{
"name": "a:tel",
"type": "string"
},
{
"name": "a:xdid",
"type": "string"
},
{
"name": "a:pladform",
"type": "string"
},
{
"name": "a:first_brow_time_cid",
"type": "string"
},
{
"name": "a:ts_stamp",
"type": "string"
},
{
"name": "a:type",
"type": "string"
}
],
"range": {
"startRowkey": "",
"endRowkey": "",
"isBinaryRowkey": true
}
}
},
"writer": {
"name": "hbase11xwriter",
"parameter": {
"hbaseConfig": {
"hbase.rootdir": "hdfs://node1:9000/hbase",
"hbase.cluster.distributed": "true",
"hbase.zookeeper.quorum": "zk1,zk2,zk3"
},
"table": "test:user_level",
"mode": "normal",
"rowkeyColumn": [
{
"index":0,
"type":"string"
},
{
"index":-1,
"type":"string",
"value":"_"
}
],
"column": [
{
"index":1,
"name":"a:oc",
"type": "string"
},
{
"index":2,
"name":"a:ol",
"type": "string"
},
{
"index":3,
"name":"a:nc",
"type": "string"
},
{
"index":4,
"name":"a:nl",
"type": "string"
},
{
"index":5,
"name":"a:ts",
"type": "string"
},
{
"index":6,
"name":"a:cid",
"type": "string"
},
{
"index":7,
"name":"a:tel",
"type": "string"
},
{
"index":8,
"name":"a:pladform",
"type": "string"
},
{
"index":9,
"name":"a:first_brow_time_cid",
"type": "string"
},
{
"index":10,
"name":"a:ts_stamp",
"type": "string"
},
{
"index":11,
"name":"a:type",
"type": "string"
}
],
"versionColumn":{
"index": -1,
"value":"123456789"
},
"encoding": "utf-8"
}
}
}
]
}
}