Updated on 2023-07-14 GMT+08:00

Step 2: Creating Links

Scenario

Before migrating a MySQL database to DWS, create the following two links:

  • MySQL link: used to connect to an RDS for MySQL DB instance
  • DWS link: used to connect to a DWS cluster

Prerequisites

  • You have an RDS for MySQL DB instance and have obtained the name, username, and password for accessing the MySQL database. In addition, you have the read, write, and delete permissions for the MySQL database.
  • You have a DWS cluster and have obtained the name, username, and password for accessing the DWS database. In addition, you have the read, write, and delete permissions for the DWS database.
  • You have uploaded the MySQL database driver by referring to Managing Drivers.

Creating a MySQL Link

  1. In the left navigation pane, choose Cluster Management. Locate the cdm-aff1 cluster created in Step 1: Creating a Cluster.
  2. Click Job Management in the Operation column of the CDM cluster. On the displayed page, click the Links tab and then Create Link. The Select Connector page is displayed.

    Figure 1 Selecting a connector

  1. Select RDS for MySQL and click Next to set the link parameters.

    Figure 2 Creating a MySQL link

    Click Show Advanced Attributes to view more optional parameters. For details, see Link to an RDS for MySQL/MySQL Database. Retain the default values of the optional parameters and configure the mandatory parameters according to Table 1.

    Table 1 MySQL link parameters

    Parameter

    Description

    Example Value

    Name

    Unique link name

    mysqllink

    Database Server

    IP address or domain name of the MySQL database server

    -

    Port

    MySQL database port

    3306

    Database Name

    Name of the MySQL database

    sqoop

    Username

    User who has the read, write, and delete permissions on the MySQL database

    admin

    Password

    Password of the user

    -

    Use Local API

    Whether to use the local API of the database for acceleration. (The system attempts to enable the local_infile system variable of the MySQL database.)

    Yes

    Use Agent

    Whether to extract data from the data source through an agent

    No

    local_infile Character Set

    When using local_infile to import data to MySQL, you can configure the encoding format.

    utf8

    Driver Version

    Before connecting CDM to a relational database, you need to upload the JDK 8 .jar driver of the relational database. Download the MySQL driver 5.1.48 from https://downloads.mysql.com/archives/c-j/, obtain mysql-connector-java-5.1.48.jar, and upload it.

    -

  2. Click Test to check whether the parameters are correctly configured. If the test is successful, click Save to create the link and return to the Links page.

    Figure 3 Created MySQL link

Creating a DWS Link

  1. Click Job Management in the Operation column of the CDM cluster. On the displayed page, click the Links tab and then Create Link. The Select Connector page is displayed.

    Figure 4 Selecting a connector

  2. Select Data Warehouse Service and click Next to configure parameters for the DWS link.

    Figure 5 Creating a DWS link
    Click Show Advanced Attributes and set optional parameters. For details, see Link to Relational Databases. Table 2 lists the mandatory parameters. Retain the default values of optional parameters.
    Table 2 DWS link parameters

    Parameter

    Description

    Example Value

    Name

    Unique link name

    dwslink

    Database Server

    IP address or domain name of the DWS database server

    -

    Port

    DWS database port

    8000

    Database Name

    Name of the DWS database

    db_demo

    Username

    User who has the read, write, and delete permissions on the DWS database

    dbadmin

    Password

    Password of the user

    -

    Use Agent

    Whether to extract data from the data source through an agent

    No

  3. Click Test to check whether the parameters are correctly configured. If the test is successful, click Save to create the link and return to the Links page.

    Figure 6 Created DWS link