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.
NoteYou 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
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 . On the page that appears, select the desired workspace from the drop-down list and click Go to Data Integration.
Create a workflow.
If you have an existing workflow, skip this step.
Move the pointer over the icon and select Create Workflow.
In the Create Workflow dialog box, configure the Workflow Name parameter.
Click Create.
Create a MySQL node.
Move the pointer over the icon and choose .
You can also find the desired workflow, right-click the workflow name, and then choose
.In the Create Node dialog box, configure the Name, Node Type, and Path parameters.
NoteThe node name cannot exceed 128 characters in length, and can contain only letters, digits, underscores (_), and periods (.).
Click Confirm. The configuration tab of the MySQL node appears.
Use the MySQL node to develop a MySQL task.
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.
NoteIn 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.
Select a resource group.
In the top toolbar, click the icon. In the Parameters dialog box, select a created resource group for scheduling.
NoteIf 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.
Use SQL statements to create a task.
Write SQL statements in the SQL editor to create a task.
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.
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.
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.
Configure basic properties for the task. For more information, see Configure basic properties.
Configure the scheduling cycle, rerun properties, and scheduling dependencies. For more information, see Configure time properties and Configure same-cycle scheduling dependencies.
NoteYou must configure the Rerun and Parent Nodes parameters on the Properties tab before you commit the task.
Configure resource properties. For more information, see Configure the resource property. If you want to access the MySQL data source over the Internet or a VPC, you must use the exclusive resource group for scheduling that is connected to the MySQL data source to run a task on the MySQL node. For more information, see Network connectivity solutions.
Commit and deploy the task.
Click the icon in the top toolbar to save the task.
Click the icon in the top toolbar to commit the task.
In the Submit dialog box, configure the Change description parameter.
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.
View the task.
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.
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.