Data Integration は、ウィザードモードとスクリプトモードでのデータ同期をサポートします。 スクリプトモードはより柔軟ですが、ウィザードモードはより簡単です。
ここでは、Table Store から (Put、Update および Delete の各アクションによって生成された) フルデータを Data Integration を使用して MaxCompute にエクスポートする方法について説明します。
ステップ 1 Table Store データソースの作成
注
- データソースがすでに作成されている場合は、この手順をスキップしてください。
- データソースを作成したくない場合は、後続の設定ページでエンドポイント、instanceName、AccessKeyID および AccessKeySecret を指定できます。
データソースの作成方法の詳細については、「Table Store データソースを作成する」をご参照ください。
ステップ 2 MaxCompute データソースを作成する
この操作はステップ 1 とほぼ同じです。 [MaxCompute] をデータソースとしてクリックするだけです。
この例では、データソースは "OTS2ODPS" という名前です。
ステップ 3 フルエクスポートトンネルの作成
- 「データ IDE」ページで、 [タスクの同期] をクリックします。
- [スクリプトモード] をクリックします。
- 表示される「インポートテンプレート」ダイアログボックスで、 "ソースの種類" を Table Store に設定し、 "対象の種類" を MaxCompute に設定します (ODPS)。
- [OK] をクリックして設定ページに移動します。
- 設定パラメーターを設定します。
{ "type": "job", "version": "1.0", "configuration": { "setting": { "errorLimit": { "record": "0" # Maximum number of errors allowed }, "speed": { "mbps": "1", # Maximum traffic, in Mbps. "concurrent": "1" # Number of concurrent tasks. } }, "reader": { "plugin": "ots", # Name of the plugin read "parameter": { "datasource": "", # Name of the data source "table": "", # Name of the table "column": [ # Name of the column in Table Store that needs to be exported to MaxCompute { "name": "column1" }, { "name": "column2" }, { "name": "column3" }, { "name": "column4" }, { "name": "column5" } ], "range": { # Range of the data to be exported. In full export mode, the range is from INF_MIN to INF_MAX. "begin": [ # Start position of the data to be exported. The minimum position is INF_MIN. The number of configuration items set in "begin" must be the same as the number of primary key columns of the table in Table Store. { "type": "INF_MIN" }, { "type": "INF_MIN" }, { "type": "STRING", # Indicates that the start position in the third column is begin1. "value": "begin1" }, { "type": "INT", # Indicates that the start position in the fourth column is 0. "value": "0" } ], "end": [ # End position of the data to be exported { "type": "INF_MAX" }, { "type": "INF_MAX" }, { "type": "STRING", "value": "end1" }, { "type": "INT", "value": "100" } ], "split": [ # Indicates the partition scope, which is not configured in normal cases. If performance is poor, you can open a ticket to submit a query. { "type": "INF_MIN" }, { "type": "STRING", "value": "splitPoint1" }, { "type": "STRING", "value": "splitPoint2" }, { "type": "STRING", "value": "splitPoint3" }, { "type": "INF_MAX" } ] } } }, "writer": { "plugin": "odps", # Name of the plugin written by MaxCompute "parameter": { "datasource": "", # Name of the MaxCompute data source "column": [], # Name of the column in MaxCompute. The column name sequence corresponds to that in Table Store. "table": "", # Name of a table in MaxCompute. It must be created first; otherwise, the task may fail. "partition": "", # It is required if the table is partitioned. For non-partition tables, do not set this parameter. The partition information of the data table must be written. Specify the parameter until the last-level partition. "truncate": false # Indicates whether to clear the previous data } } } }
注 詳細な設定については、「Table Store Reader の設定」および「MaxCompute Writer の設定」をご参照ください。 - [保存] をクリックします。
ステップ 4 タスクの実行 (テスト)
- ページの上部にある [操作] をクリックします。
設定に変数が含まれていない場合、タスクはただちに実行されます。 変数が存在する場合は、変数の実際の値を入力してから [OK] をクリックする必要があります。 その後、タスクは実行を開始します。
- タスクを実行した後、タスクが成功したかどうかを確認し、ログ内のエクスポートされたデータ行の数を表示できます。
ステップ 5 スケジューリングパラメーターの設定
- ページの上部にある [データ開発] をクリックします。
- [タスク開発] タブで、作成したタスク [OTStoODPS] をダブルクリックします。
- [スケジュール設定] をクリックします。スケジューリングパラメーターを設定します。
翌日にタスクの実行を開始するように設定するには、図のように次のパラメーターを設定します。
設定は次のとおりです。
パラメーター 説明 スケジュール状況 デフォルトでは選択されておらず、タスクの実行を示します。 自動再試行 エラー発生後にシステムが再試行できるように、このパラメータを選択することを推奨します。 有効化の日付け デフォルト値を推奨します。 スケジュール期間 この例では分が使用されています。 開始時間 この例では 00 時 00 分 に設定されています。 間隔 この例では、スケジューリング間隔は 5 分に設定されています。 終了時間 この例では 23 時 59 分 に設定されています。 依存属性 "依存属性" をビジネスニーズに応じて設定するか、デフォルト値をそのまま使用します。 クロスサイクル依存関係 "クロスサイクル依存関係" をビジネスに応じて設定するか、デフォルト値をそのまま使用します。 - [パラメーター設定] をクリックして、パラメータを設定します。
パラメーターは次のように記述されます。
パラメーター 説明 ${bdp.system.bizdate} 設定する必要はありません。 startTime [スケジュール設定] で設定した開始時間変数です。 この例では、 "$[yyyymmddhh24miss-10/24/60]" に設定されており、スケジューリングタスクの開始時間から10分を引いた時間に相当します。 endTime [スケジュール設定] で設定した終了時間変数です。 この例では、 "$[yyyymmddhh24miss-5/24/60]" に設定されており、スケジューリングタスクの開始時間から 5 分を引いた時間に相当します。
ステップ 6 タスクの送信
- ページ上部にある [送信] をクリックします。
- 表示されたボックスで、 [送信を確認] をクリックします。
タスクが送信された後、現在のファイルは読み取り専用です。
ステップ 7 タスクの確認
- ページの上部にある [オペレーションセンター] をクリックします。
- 左側のナビゲーションウィンドウで、 クリックして、新しく作成したタスク "OTStoODPS" を表示します。
- タスクは翌日の 00 時 00 分 に実行を開始します。
- 左側のナビゲーションウィンドウで、 をクリックし 、その日に実行されるスケジューリングタスクを表示します。 詳細を表示するには、インスタンス名をクリックしてください。
- タスクの実行中または完了後にログを表示できます。
ステップ8 MaxCompute にインポートされたデータの表示
- ページの上部にある [データの管理] をクリックします。
- 左側のナビゲーションウィンドウで、[すべてのデータ] をクリックします。
- データのインポート先のテーブル (ots_gps_data) を見つけ、そのテーブルをクリックして対応する詳細ページに移動します。
- 右側で、 [データのプレビュー] をクリックして、インポートしたデータを表示します。