Updated on 2022-09-15 GMT+08:00

Step 2: Creating Links

Scenario

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

  1. MySQL link: used to connect to the on-premises MySQL database.
  2. DWS link: used to connect to the DWS database.

CDM needs to access the on-premises data source. Therefore, before creating links, bind an EIP to the CDM cluster.

Prerequisites

  • Your on-premises MySQL database can be accessed using the public IP address.
  • You have obtained the IP address, port, database name, username, and password for connecting to the MySQL database. In addition, the user has the read, write, and delete permissions on the MySQL database.
  • You have a DWS instance and have obtained the IP address, port number, database name, username, and password for accessing DWS. In addition, the user has the read, write, and delete permissions for the DWS database.
  • You have uploaded the MySQL database driver by referring to Managing Drivers.

Binding an EIP to a CDM Cluster

  1. Log in to the CDM management console.
  2. Locate a CDM cluster and click Bind EIP in the Operation column. In the displayed dialog box, select an EIP.

    If no EIP is available, create one as prompted.

  3. Click OK.

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. In the Operation column, click Bind EIP, and select and bind an EIP to the 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.

  3. 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 MySQL and click Next. On the page that is displayed, configure MySQL link parameters.

    Figure 2 Creating a MySQL link

    Click Show Advanced Attributes and set optional parameters. For details, see Link to Relational Databases. 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

    192.168.1.110

    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

    Yes

    local_infile Character Set

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

    utf8

    Driver Version

    A driver version that adapts to MySQL

    -

    Agent

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

    -

    Fetch Size

    (Optional) Displayed when you click Show Advanced Attributes.

    Number of rows obtained by each request. Set this parameter based on the data source and the job's data size. If the value is either too large or too small, the job may run for a long time.

    1000

    Commit Size

    (Optional) Displayed when you click Show Advanced Attributes.

    Number of records submitted each time. Set this parameter based on the data destination and the job's data size. If the value is either too large or too small, the job may run for a long time.

    1000

    Link Attributes

    Custom attributes of the link

    useCompression=true

    Reference Sign

    Delimiter used to separate referenced table names or column names This parameter is left blank by default.

    '

    Batch Size

    Number of rows written each time. It should be less than Commit Size. When the number of rows written reaches the value of Commit Size, the rows will be committed to the database.

    100

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

    If an error occurs during the saving, the security settings of the MySQL database are incorrect. In this case, you need to enable the EIP of the CDM cluster to access the MySQL database.

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 3 Selecting a connector

  2. Select Data Warehouse Service and click Next to configure the DWS link parameters. Set the mandatory parameters listed in Table 2 and retain the default values for the 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

    192.168.0.3

    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

    Yes

    Agent

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

    -

  3. Click Save.