Data Integration は、ウィザードモードとスクリプトモードでのデータ同期をサポートします。 スクリプトモードはより柔軟ですが、ウィザードモードはより簡単です。

ここでは、必要に応じてデータをダウンロードしたり、 Table Store のバックアップデータとして OSSに保存したりできるように、Data Integration のスクリプトモードを使用して Table Store の全データを OSS にエクスポートする方法について説明します。

チャンネル

Data Integration のスクリプトモード
  • 読み取り: OTSReader
  • 書き込み: OSSWriter

ステップ 1 Table Store データソースの作成

Table Store データソースを作成してある場合は、この手順をスキップしてください。

データソースの作成方法の詳細については、 「Table Store データソースの作成」をご参照ください。

ステップ 2 OSS データソースの作成

この操作はステップ 1 とほぼ同じです。 データソースとして OSS を選択するだけです。
OSS データソースのパラメータ設定中、エンドポイントに bucketName は含まれません。

ステップ 3 エクスポートタスクの作成

  1. Data Integration コンソールにログインします。
  2. タスク同期」ページで、 [スクリプトモード] をクリックします。
  3. インポートテンプレート」ダイアログボックスで、 "ソースの種類" を Table Store(OTS)に設定し、 対象の種類を OSS に設定します。
  4. [OK] をクリックして設定を終了します。

ステップ 4 設定項目の設定

  1. 設定ページには、OTSReader と OSSWriter のテンプレートが用意されています。 以下の注釈を参照して設定を完了してください。
    {
    "type": "job",    # It cannot be modified.
    "version": "1.0",  # It cannot be modified.
    "configuration": {
     "setting": {
       "errorLimit": {
         "record": "0"  # The import task fails when the number of error records exceeds the value.
       },
       "speed": {
         "mbps": "1",  # Import speed, in Mbps.
         "concurrent": "1"  # Concurrency.
       }
     },
     "reader": {
       "plugin": "ots",  # It cannot be modified.
       "parameter": {
         "datasource": "",   # Name of the data source in Data Integration, which must be set in advance. You can configure data source or write authentication information such as the AccessKeyID in plaintext. We recommend that you configure data source.
         "table": "",    # Table name in Table Store.
         "column": [   # Name of the column that needs to be exported to OSS. If all the columns need to be exported to OSS, set this parameter to an empty array.
           {
             "name": "column1"    # Name of the column in Table Store, which needs to be imported to OSS
           },
           {
             "name": "column2"   # Name of the column in Table Store, which needs to be imported to OSS
           }
         ],
         "range": {
           "begin": [
             {
               "type": "INF_MIN"   # Start position of the first primary key column in Table Store. If you want to export full data, set this parameter to INF_MIN. If you want to export a portion of the data, set this parameter as needed. The number of configuration items in "begin" must be the same as the number of primary key columns.
             }
           ],
           "end": [
             {
               "type": "INF_MAX"   # End position of the first primary key column in Table Store. If you want to export full data, set this parameter to INF_MAX. If you want to export a portion of the data, set this parameter as needed.
             }
           ],
           "split": [  # Used to configure partition information about the Table Store table, which can accelerates the export. In the next version, this configuration is automatically processed.
           ]
         }
       }
     },
     "writer": {
       "plugin": "oss",
       "parameter": {
         "datasource": "",  # Name of the OSS data source
         "object": "",  # Prefix of the object excluding the bucket name, for example, tablestore/20171111/. If the export is scheduled, a variable, for example, tablestore/${date}, must be used, and ${date} must be configured when the scheduling parameters are set.
         "writeMode": "truncate", # truncate, append, and nonConflict are supported. truncate is used to clear existing files with the same name, append is used to add the data to existing files with the same name, and nonConflict is used to return an error when files with the same name exist. truncate is used during full export.
         "fileFormat": "csv", # CSV and TXT are supported.
         "encoding": "UTF-8",  # Encoding mode
         "nullFormat": "null", # Defines a string identifier that represents the null value. It can be an empty string.
         "dateFormat": "yyyy-MM-dd HH:mm:ss",  # Time format
         "fieldDelimiter": "," # Delimiter of each column
       }
     }
    }
    }
  2. [保存] をクリックして、タスクを保存します。

ステップ 5 タスクの実行

  1. [操作] をクリックして、タスクを実行します。

    設定に変数が含まれている場合、たとえば "${date}" の場合、変数設定ページが表示されます。 設定できるのは特定の値だけです。

  2. ページの下部にログを表示します。
    エラーがログに記録されていない場合、タスクは正常に実行されており、ターゲット OSS インスタンスのデータを確認できます。
    フルエクスポートは通常 1 回限りの作業であるため、自動スケジュール設定パラメータを設定する必要はありません。 スケジューリングパラメータの設定方法の詳細については、 「増分同期」をご参照ください。

ステップ 6 OSS にエクスポートされたデータの確認

  1. OSS コンソールにログインします。
  2. バケットとファイル名を選択して、その内容を確認してください。