All Products
Search
Document Center

DataWorks:Configure a MySQL node

Last Updated:Dec 06, 2024

DataWorks provides MySQL nodes that you can use to develop and periodically schedule MySQL tasks and integrate MySQL tasks with other types of tasks. This topic describes how to use a MySQL node to develop tasks.

Prerequisites

  • A workflow is created.

    Development operations in different types of compute engines are performed based on workflows in DataStudio. Therefore, before you create a node, you must create a workflow. For more information, see Create a workflow.

  • A MySQL data source is added.

    You must add your MySQL database to DataWorks as a MySQL data source before you can use the data source to access data in the database. For more information, see MySQL data source.

    Note

    You can create MySQL nodes based on only MySQL data sources that are added to DataWorks in connection string mode.

  • (Required if you use a RAM user to develop tasks) The RAM user is added to the DataWorks workspace as a member and is assigned the Develop or Workspace Administrator role. The Workspace Administrator role has more permissions than necessary. Exercise caution when you assign the Workspace Administrator role. For more information about how to add a member and assign roles to the member, see Add workspace members and assign roles to them.

Limits

  • MySQL nodes can be used to develop MySQL tasks only for MySQL data sources that are added in connection string mode in the production environment. To view the mode in which a data source is added, follow the instructions that are described in Add a MySQL data source to go to the Data Sources page, find the desired data source, and then click Modify in the Operation column.

  • MySQL nodes do not support data sources of MySQL 8.0 or later.

  • This type of node is supported in the following regions: China (Hangzhou), China (Shanghai), China (Beijing), China (Shenzhen), China (Chengdu), China (Hong Kong), Singapore, Malaysia (Kuala Lumpur), Indonesia (Jakarta), and US (Virginia).

Network connectivity

  • Network connectivity description

    When a MySQL node runs, the node must access the MySQL service. Therefore, you must make sure that the MySQL data source selected for the node is connected to the serverless resource group on which the node runs. For more information about how to connect a data source to a serverless resource group, see Network connectivity solutions.

  • IP address whitelist configuration

    If an IP address whitelist is configured for the MySQL data source selected for a MySQL node, you must add the required information about the serverless resource group on which the node runs to the whitelist. For more information, see Configure an IP address whitelist.

  • Network connectivity test

    You can test the network connectivity of a MySQL data source when you add the MySQL data source to DataWorks. For more information, see Test network connectivity.

Create and use a MySQL node to develop a task

  1. Go to the DataStudio page.

    Log on to the DataWorks console. In the top navigation bar, select the desired region. In the left-side navigation pane, choose Data Development and Governance > Data Integration. On the page that appears, select the desired workspace from the drop-down list and click Go to Data Integration.

  2. Create a workflow.

    If you have an existing workflow, skip this step.

    1. Move the pointer over the 新建 icon and select Create Workflow.

    2. In the Create Workflow dialog box, configure the Workflow Name parameter.

    3. Click Create.

  3. Create a MySQL node.

    1. Move the pointer over the 新建 icon and choose Create Node > Database > MySQL.

      You can also find the desired workflow, right-click the workflow name, and then choose Create Node > Database > MySQL.

    2. In the Create Node dialog box, configure the Name, Node Type, and Path parameters.

      Note

      The node name cannot exceed 128 characters in length, and can contain only letters, digits, underscores (_), and periods (.).

    3. Click Confirm. The configuration tab of the MySQL node appears.

  4. Use the MySQL node to develop a MySQL task.

    1. Select a data source.

      Select the data source that you want to use to develop a task from the Select Data Source drop-down list. If you cannot find the data source that you want to use from the drop-down list, click Add Data Source to the right of Select Data Source and add a data source on the Data Sources page. For more information, see Add a MySQL data source.

      Note
      • In a workspace in standard mode, only MySQL data sources that are configured for both production and development environments are displayed in the Select Data Source drop-down list.

      • MySQL nodes can be used to develop MySQL tasks only for MySQL data sources that are added in connection string mode in the production environment. To view the mode in which a data source is added, follow the instructions that are described in Add a MySQL data source to go to the Data Sources page, find the desired data source, and then click Modify in the Operation column.

    2. Select a resource group.

      In the top toolbar, click the 高级运行 icon. In the Parameters dialog box, select a created resource group for scheduling.

      Note
      • If you want to access a data source over the Internet or a VPC, you must use the resource group for scheduling that is connected to the data source. For more information, see Network connectivity solutions.

      • If you want to change the resource group in subsequent operations, you can click the 高级运行 icon to change the resource group in the Parameters dialog box.

    3. Use SQL statements to create a task.

      Write SQL statements in the SQL editor to create a task.SQL编辑区

      In this example, the following statement is used to query data in the xc_emp table. You can write SQL statements that you want to execute based on your business requirements and the syntax that is supported by MySQL.

      select * from xc_emp;

      The following figure shows the results.运行结果

      If the task fails, you can view the error message and troubleshoot the issue based on the instructions in When the task runs, the system displays an error message indicating that the JDBC driver is not supported. What do I do? in this topic.

    4. Save and execute the SQL statements.

      In the top toolbar, click the 保存 icon to save the SQL statements. Then, click the 运行 icon to execute the SQL statements.

  5. Configure task scheduling properties.

    If you want the system to periodically run a task on the node, you can click Properties in the right-side navigation pane on the configuration tab of the node to configure task scheduling properties based on your business requirements.

  6. Commit and deploy the task.

    1. Click the 保存 icon in the top toolbar to save the task.

    2. Click the 提交 icon in the top toolbar to commit the task.

    3. In the Submit dialog box, configure the Change description parameter.

    4. Click Confirm.

    If you use a workspace in standard mode, you must deploy the task in the production environment after you commit the task. To deploy a task on a node, click Deploy in the top navigation bar of the DataStudio page. For more information, see Deploy tasks.

  7. View the task.

    1. Click Operation Center in the upper-right corner of the configuration tab of the corresponding node to go to Operation Center in the production environment.

    2. View the scheduled task. For more information, see View and manage auto triggered tasks.

    To view more information about the task, click Operation Center in the top navigation bar of the DataStudio page. For more information, see Overview.

When the task runs, the system displays an error message indicating that the JDBC driver is not supported. What do I do?

  • Problem description

    The MySQL data source that is not added in connection string mode is selected for the MySQL node used to develop the MySQL task. As a result, the task fails to run, and the system displays an error message indicating that SQL execution failed and the JDBC driver is not supported.

  • Cause

    A MySQL data source that is not added in connection string mode is used.

  • Solution

    Select a data source that is added in connection string mode. To view the mode in which a data source is added, follow the instructions that are described in Add a MySQL data source to go to the Data Sources page, find the desired data source, and then click Modify in the Operation column.

The connectivity test is successful, but the task fails to run. What do I do?

  • Possible cause 1: The resource group that is selected is invalid. In this case, check whether the resource group for scheduling on which the node is run is selected for the connectivity test. For more information, see the (Optional) Test the network connectivity of the exclusive resource group section of the "Create and use an exclusive resource group for scheduling" topic.

  • Possible cause 2: The resource group for scheduling that is used for the connectivity test is not selected to run the task. In this case, click the 高级运行 icon to change the resource group for scheduling in the Parameters dialog box.