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

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安装部署及小试

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容