大數據

阿里雲Dataworks數據集成工具實現:OTS -> Maxcompute數據同步

Step By Step

1、配置數據源 + 測試連通性
  • 1.1 Table Store(OTS)參數獲取
    圖片.png
  • 1.2、AccessKey、AccessSecret獲取
    阿里雲常見參數獲取位置
  • 1.3 Dataworks數據集成配置OTS數據源
    圖片.png
  • 1.4 Maxcompute數據源配置
    圖片.png
2、源數據準備及目標表創建
  • 2.1 OTS 源數據表
    圖片.png

圖片.png
圖片.png

  • 2.2 odps數據表創建

CREATE TABLE otstoodps (id INT,name STRING);

3、創建數據集成任務(OTS數據源當前僅支持腳本模式)
  • 3.1 腳本Sample
{
    "type": "job",
    "steps": [
        {
            "stepType": "ots",
            "parameter": {
                "datasource": "otsdemo",
                "column": [
                    {
                        "name": "id"
                    },
                    {
                        "name": "name"
                    }
                ],
                "range": {
                    "end": [
                        {
                            "type": "INF_MAX"
                        }
                    ],
                    "begin": [
                        {
                            "type": "INF_MIN"
                        }
                    ]
                },
                "table": "otsreader2"
            },
            "name": "Reader",
            "category": "reader"
        },
        {
            "stepType": "odps",
            "parameter": {
                "partition": "",
                "truncate": true,
                "datasource": "odps_first",
                "column": [
                    "id",
                    "name"
                ],
                "emptyAsNull": false,
                "table": "otstoodps"
            },
            "name": "Writer",
            "category": "writer"
        }
    ],
    "version": "2.0",
    "order": {
        "hops": [
            {
                "from": "Reader",
                "to": "Writer"
            }
        ]
    },
    "setting": {
        "errorLimit": {
            "record": ""
        },
        "speed": {
            "concurrent": 2,
            "throttle": false
        }
    }
}
  • 3.2 注意事項

a、ots Reader 表示將主鍵名也放在column中;
b、reader column的順序和writer column的順序要一致。

4、測試運行 + 調度配置
  • 4.1 測試運行
    圖片.png
  • 4.2 目標表結果查看
    圖片.png
  • 4.3 調度配置(測試運行成功後,可以配置週期調度,將任務提交到運維中心週期運行)
    圖片.png

參考鏈接

Table Store(OTS) Reader
MaxCompute Writer

Leave a Reply

Your email address will not be published. Required fields are marked *