Create an offline data synchronization task
You can create offline data synchronization tasks. These tasks support various cloud compute resource types, such as MySQL, Oracle, SQL Server, HDFS, FTP, PostgreSQL, Hive, MaxCompute, AnalyticDB for PostgreSQL, and OSS. This topic describes how to create an offline data synchronization task by synchronizing data from a MySQL data source to a MaxCompute destination.
Prerequisites
A corresponding data source must already exist. For more information, see Create a data source.
The physical tables of the source and destination have been retrieved. For more information, see Get physical tables.
A folder for offline data synchronization tasks has been added. For more information, see Add a task folder.
Procedure
Log on to the Data Resource Platform console.
In the upper-left corner of the page, click the
icon and select Collaboration.In the top menu bar, click the
icon, select the target workgroup, and click Asset Processing.In the navigation pane on the left, click the
icon, hover over Offline Data Synchronization, and click the
icon.On the Offline Data Synchronization page, click New Task.
Configure the basic information for the task. At the top of the Offline Data Synchronization Management page, enter a task name, category, and description.
Configure the synchronization resources, including the source and destination.
Parameter
Description
Source configuration
Data source
Select the source data source.
Click View Supported Synchronization Paths to see the supported sources and destinations for offline synchronization paths.
In the data source drop-down list, click Create Data Source to create a cloud compute resource in the panel that appears.
Data table
Select the data table to synchronize.
In the data table drop-down list, click Get Physical Tables to get the latest physical table metadata.
After you select a data table, click View Field Information to see the details of the physical table's fields.
Synchronization mode
Full and incremental synchronization modes are supported.
If you select Full, you can enter a custom SQL condition to perform a full data synchronization. This feature is available only for MySQL and PostgreSQL data sources.
If you select Incremental, you can configure the following:
Incremental field key or value.
Field data type: Time String, Integer String, Float String, or String.
The data field options are available only for relational database data sources, such as MySQL, Oracle, SQL Server, and PostgreSQL.
Applicable field types include string fields, such as:
Oracle string types: varchar, varchar2, char.
MySQL string types: varchar, char.
Data retrieval rule: This rule applies only to date data. `yyyy` represents a four-digit year, `yy` a two-digit year, `mm` (or `MM`) the month, `dd` the day, `hh24` the hour (use `hh` for 12-hour format), `mi` the minute, and `ss` the second. You can combine these parameters as needed, for example, $[yyyymmdd], $[yyyy-mm-dd], $[hh24miss], $[hh24:mi:ss], and $[yyyymmddhh24miss].
The ${} expression retrieves the data timestamp. The minimum unit is day. For example, ${yyyyMMdd} retrieves data from the previous day, and ${yyyyMM-1} retrieves data from the previous month.
The $[] expression retrieves the scheduled time. The minimum unit is day. For example, $[yyyyMMdd-1/24] retrieves data from one hour before the current time.
The timestamp functions sysMillis (millisecond) and sysSeconds (second) are supported. The unit is day. For example, ${sysMillis} retrieves data from the previous day.
Custom condition
Enter a condition for the WHERE clause of an SQL statement. You do not need to enter the WHERE keyword. This condition is used for data filtering during synchronization. Variable parameters are not currently supported. Example: mydate<'2022-12-19'.
Destination configuration
Destination
Select the destination data source.
In the data source drop-down list, click Create Data Source to create a cloud compute resource in the panel that appears.
Data table
Select or create a destination data table for synchronization.
In the data table drop-down list, click Create Destination Object to create a table as the destination. You can create a partitioned table.
In the data table drop-down list, click Get Physical Tables to get the latest physical table metadata.
Partition field
Information about the partition field.
Write rule
Select a write rule: Clear existing data before writing or Keep existing data. If a data retrieval rule is set, this feature is unavailable.
Configure the field mapping. In the Field Mapping section, fields with the same name are mapped by default. You can select same-row mapping or create custom mappings by dragging connection lines.
Configure general controls.
Parameter
Description
Dependency configuration
Configure upstream dependencies. The task can depend on a synchronization node or a data development node from the same schedule period. If you enable this feature, the current node runs only after its ancestor nodes run successfully.
Table schema change
Select whether to detect table schema changes. If you enable this feature, the system checks the source table schema daily. If a schema evolution is detected, an alert is pushed. You can view the alert details in Service Monitoring > DataQ - Overwatch.
Resource group
Select a resource group.
Resource specification
Set the CPU cores (default: 2) and memory (default: 1024 MB) required for the task instance to run.
Rate
Set the maximum rate for the task. The task runs as close to this rate as possible without exceeding it.
Bytes/s: The maximum number of bytes transferred per channel per second.
Records/s: The maximum number of records transferred per channel per second.
NoteThe rate is limited by whichever threshold, bytes or records, is reached first.
On the right side of the page, click Scheduling Configuration to set the schedule for the task.
Parameter
Description
Recurring schedule
Depends on the previous run of this node
After you enable recurring scheduling, select whether to enable the dependency on the previous run of this node.
Auto-unpublish on error
Select whether to automatically unpublish the task if an error occurs.
Effective date
The task is automatically scheduled only within the effective date range. Outside this range, the task is not automatically scheduled and cannot be run manually.
Schedule period
The schedule period for both full and incremental synchronization can be set to minute, hour, day, week, or month.
Minute: Set the start time, end time, and interval. The interval specifies how many minutes to wait between runs.
Hour: Set the start time, end time, and interval. The interval specifies how many hours to wait between runs.
Day: Set the specific time of day for the sync task to run.
Week: Select the days of the week and the specific time for the task to run. You can select multiple days.
Month: Select the days of the month and the specific time for the task to run. You can select multiple days.
Cron expression
Select Manual Modification to enter a custom cron expression.
Retry on failure
Number of retries
After you enable retries on failure, set the number of retries.
Retry interval (seconds)
Set the interval between retries in seconds.
Timeout
Set the task timeout period in minutes.
Monitoring configuration
If you enable this feature, published sync tasks are automatically pushed to Monitoring Job Management in Service Monitoring. This feature is enabled by default.
After you complete the configuration, in the upper-left corner of the Offline Data Synchronization Management page, click the
icon.A message is displayed indicating that the task was created successfully.
Related operations
Operation | Description |
View a sync task | In the task list, find the target sync task, click More in the Actions column, and select View to see the task details. |
Modify a sync task | In the task list, for a sync task that is not running, click More in the Actions column and select Modify. |
Delete a sync task |
|
View dependent nodes | Find the target sync task, click More in the Actions column, and select Descendant Nodes to view the ancestor and descendant nodes of the current task. |
View run history | Find the target sync task and click Run History in the Actions column to view the run history of the sync task. |
What to do next
After you create a sync task, you must publish it. For more information, see Publish an offline data synchronization task.