Migrating Data from DDS to DWS

Scenario

CDM allows you to migrate data from DDS to other data sources. This section describes how to use CDM to migrate data from DDS to DWS. The procedure includes four steps:

  1. Creating a CDM Cluster and Binding an EIP to the Cluster
  2. Creating a DDS Link
  3. Creating a DWS Link
  4. Creating a Migration Job

Prerequisites

  • You have purchased DWS/DDS clusters.
  • You have obtained the IP address, port number, database name, username, and passwords for connecting to the DWS and DDS databases. In addition, you must have read, write, and delete permissions for the DDS and DWS databases.

Creating a CDM Cluster and Binding an EIP to the Cluster

  1. Create a CDM cluster. For details, see Buying a DGC Incremental Package. The key configurations are as follows:

    • The flavor of the CDM cluster is selected based on the amount of data to be migrated. Generally, cdm.medium meets the requirements for most migration scenarios.
    • If DDS and DWS are deployed in the same VPC, the newly created CDM cluster also needs to be deployed in that VPC, and with no EIP bound. The CDM cluster's subnet and security group can be the same as those of the DDS or DWS cluster. You can also configure a security group rule to enable the CDM cluster to access the cluster of another service (DWS or DDS).
    • If DDS and DWS are not deployed in the same VPC, the newly created CDM cluster needs to be in the same VPC as DDS. An EIP must be bound as described in Binding or Unbinding EIPs for the CDM cluster to access the DWS cluster.

  2. After the CDM cluster is created, on the Cluster Management page, click Bind EIP in the Operation column to bind an EIP to the cluster. The CDM cluster uses the EIP to access DWS. If DDS and DWS are in the same VPC, do not bind an EIP to the CDM cluster.

    If SSL encryption is configured for the access channel of a local data source, CDM cannot connect to the data source using the EIP.

Creating a DDS Link

  1. Click Job Management in the Operation column of the CDM cluster. On the page that is displayed, choose Link Management > Create Link. The page for selecting a connector is displayed. See Figure 1.

    Figure 1 Selecting a connector

  2. To create a DDS link, select Document Database Service and click Next. On the page that is displayed, configure the link parameters based on Table 1.

    Table 1 DDS link parameters

    Parameter

    Description

    Example Value

    Name

    The link name, which should be chosen based on the data source type, so it is easier to remember what the link is for.

    mongo_link

    MongoDB Server List

    And address list for the DDS cluster. The format is IP address or domain name of the database server:port. Separate multiple server lists with semicolons (;).

    192.168.0.1:7300;192.168.0.2:7301

    Database Name

    The name of the DDS database to be connected

    DB_mongodb

    Username

    The username for logging in to the DDS database

    cdm

    Password

    The password for logging in to the DDS database

    N/A

  3. Click Save. The Link Management page is displayed.

Creating a DWS Link

  1. On the Link Management tab page, click Create Link and select Data Warehouse Service to create a DWS link.
  2. Click Next. The page for configuring the DWS link parameters is displayed. Configure the mandatory parameters described in Table 2 and retain the default values for optional parameters.

    Table 2 DWS link parameters

    Parameter

    Description

    Example Value

    Name

    A unique link name

    dwslink

    Database Server

    The IP address or domain name of the DWS database server

    192.168.0.3

    Port

    The DWS database port

    8000

    Database Name

    The name of the DWS database

    db_demo

    Username

    A user with read, write, and delete permissions for the DWS database

    dbadmin

    Password

    The password of the user

    N/A

    Use Agent

    Whether to extract data from the data source through an agent

    Yes

    Agent

    Click Select and select the agent created in Connecting to an Agent.

    N/A

    Import Mode

    When creating a DWS link, select the data import mode.
    • COPY: Source data is migrated to the DWS management node and then copied to DataNodes. To access DWS through the Internet, select COPY.
    • GDS: DataNodes of DWS concurrently request data from the GDS component of CDM and then write data to DWS. GDS mode cannot be used for data export from DWS.

    Theoretically, the GDS mode is more efficient than the COPY mode. If the GDS mode is used, you need to modify the security group configuration on VPC. Modify the security group rule of the CDM cluster so that the DWS data node can access port 25000 of the internal IP address of the CDM cluster.

    COPY

  3. Click Save. The link is successfully created.

Creating a Migration Job

  1. Choose Table/File Migration > Create Job to create a data migration job.

    Figure 2 Creating a job for migrating data from DDS to DWS

  2. Configure the required job details:

    • Job Name: Enter a unique job name.
    • Source Job Configuration
      • Source Link Name: Select the mongo_link link created in Creating a DDS Link.
      • Database Name: Select the database whose data will be migrated.
      • Collection Name: Enter the name of the MongoDB collection on DDS, which should be similar to the table name in a relational database.
    • Destination Job Configuration
      • Destination Link Name: Select the dwslink link created in Creating a DWS Link.
      • Schema/Tablespace: Select the DWS database that the data will be written to.
      • Table Name: The name of the table the data will be written to. You can manually enter a table name that does not exist. CDM automatically creates the table on DWS.
      • Clear Data Before Import: Choose whether to clear data in the destination table before data import.

  3. Click Next. The Map Field tab page is displayed. CDM automatically maps table fields at the migration source and destination. Check whether the field mapping is correct.

    • If the field mapping is incorrect, click the row where the field is located and drag the field to adjust the mapping.
    • When importing data to DWS, you need to manually select the distribution columns of DWS. You are advised to select the distribution columns according to the following principles:
      1. Use the primary key as the distribution column.
      2. If multiple data segments are combined as primary keys, specify all primary keys as the distribution column.
      3. If no primary key is available, and no distribution column is selected, DWS uses the first column as the distribution column by default. As a result, the data may be skewed.
    • If you need to convert the content of the source fields, refer to Field Conversion. In this example, the field conversion is not required.
    Figure 3 Field mapping 1

  4. Click Next and set task parameters. Generally, you can retain the default values for all parameters.

    In this step, you can configure the following optional functions:
    • Retry Upon Failure: If the job fails, you can determine whether to automatically retry the job. Retain the default value Never.
    • Group: Select which group the job belongs to. The default group is DEFAULT. On the Job Management page, jobs can be displayed, started, or exported by group.
    • Schedule Execution: To configure scheduled jobs, see Scheduling Job Execution. Retain the default value No.
    • Concurrent Extractors: Enter the number of extractors to be executed concurrently. Retain the default value 1. The maximum number of concurrent extractors in a single job is 500.
    • Write Dirty Data: Specify this parameter if data that fails to be processed or filtered out during job execution needs to be written to OBS for future viewing. Before writing dirty data, create an OBS link. Retain the default value No so that dirty data is not recorded.
    • Delete Job After Completion: Retain the default value Do not delete.

  5. Click Save and Run. The Job Management page is displayed, on which you can view the job execution progress and result.
  6. After the job is successfully executed, in the Operation column of the job, click Historical Record to view the job's historical execution records and read/write statistics.

    On the Historical Record page, click Log to view the job logs.