美文网首页
不同账号阿里云表格存储跨区域数据迁移

不同账号阿里云表格存储跨区域数据迁移

作者: henry技术探索记录员 | 来源:发表于2020-03-16 11:40 被阅读0次
    1. 安装datax

    下载编译好的datax,copy到一个ECS服务器实例上,解压即可:


    image.png
    2. 为每个表格table编写迁移脚本
    {
        "job": {
            "setting": {
                "speed": {
                    "channel": "5"
                }
            },
            "content": [{
                "reader": {
                    "name": "otsreader",
                    "parameter": {
                        "endpoint": "https://xxx.cn-shanghai.ots.aliyuncs.com",
                        "accessId": "xxx",
                        "accessKey": "xxx",
                        "instanceName": "xxx",
                        "table": "BALANCE_DETAIL",
                        "column": [{
                                "name": "partition_key"
                            },
                            {
                                "name": "primaryKey1"
                            },
                            {
                                "name": "primaryKey2"
                            },
                            {
                                "name": "primaryKey3"
                            },
                            {
                                "name": "col1"
                            },
                            {
                                "name": "col2"
                            },
                            {
                                "name": "col3"
                            }
                        ],
                        "range": {
                            "begin": [{
                                "type": "INF_MIN"
                            },{
                                "type": "INF_MIN"
                            },{
                                "type": "INF_MIN"
                            },{
                                "type": "INF_MIN"
                            }],
                            "end": [{
                                "type": "INF_MAX"
                            },{
                                "type": "INF_MAX"
                            },{
                                "type": "INF_MAX"
                            },{
                                "type": "INF_MAX"
                            }]
                        }
                    }
                },
                "writer": {
                    "name": "otswriter",
                    "parameter": {
                        "endpoint": "http://yyy.cn-hongkong.vpc.ots.aliyuncs.com",
                        "accessId": "yyy",
                        "accessKey": "yyy",
                        "instanceName": "yyy",
                        "table": "yyy",
                        "primaryKey": [{
                            "name": "partition_key",
                            "type": "string"
                        },{
                            "name": "primaryKey1",
                            "type": "string"
                        },{
                            "name": "primaryKey2",
                            "type": "int"
                        },{
                            "name": "primaryKey3",
                            "type": "int"
                        }],
                        "column": [{
                                "name": "col1",
                                "type": "string"
                            },
                            {
                                "name": "col2",
                                "type": "string"
                            },
                            {
                                "name": "col3",
                                "type": "string"
                            }
                        ],
                        "writeMode": "PutRow"
                    }
                }
            }]
        }
    }
    
    • endpoint为表格存储实例的访问url;
    • accessId和accessKey到阿里云网站账号的AccessKey管理中查找到;
    • instanceName为表格存储实例名
    • table为表格名
    3. 将脚本拷贝到datax的job目录下:
    image.png image.png image.png
    4. 逐个执行脚本进行数据迁移
    root$ python /usr/local/datax/bin/datax.py /usr/local/datax/job/dev/xxx.json
    

    参考:
    DataX迁移工具
    DataX安装部署及小试

    相关文章

      网友评论

          本文标题:不同账号阿里云表格存储跨区域数据迁移

          本文链接:https://www.haomeiwen.com/subject/ixtgehtx.html