码迷,mamicode.com
首页 > 其他好文 > 详细

Datax:阿里云hbase数据导入到自建hbase集群

时间:2020-01-08 19:28:15      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:connector   clu   amp   hba   for   data   本地   plugin   下载   

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

https://hbaseuepublic.oss-cn-beijing.aliyuncs.com/alihbase-connector-1.0.11.jar?spm=a2c4g.11186623.2.13.38c544faLuyLz7&file=alihbase-connector-1.0.11.jar

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"
          }
        }
      }
    ]
  }
}

Datax:阿里云hbase数据导入到自建hbase集群

标签:connector   clu   amp   hba   for   data   本地   plugin   下载   

原文地址:https://www.cnblogs.com/stone1989/p/12168078.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!