Help Center/ Data Replication Service/ Data Subscription/ Creating a Data Subscription Task
Updated on 2022-09-21 GMT+08:00

Creating a Data Subscription Task

Supported Databases

Table 1 Database information

DB Engine

Data Type

RDS for MySQL

Version 5.6 and 5.7

  • Data update
  • Structure update

Precautions

You can create a subscription task to obtain the data change information of key services in the database. This type of information is often required by downstream services. Data subscription helps cache incremental data and provides a unified SDK interface for downstream applications to subscribe to and consume the incremental data.

To create a data subscription task successfully, you need implement the following two steps:

  1. Create a data subscription task on the DRS console.
  2. Use the SDK API of DRS to access the data subscription channel and subscribe to and consume incremental data.

The following describes constraints on data subscription tasks. Before using DRS, you need to ensure that the source and destination databases meet the following constraints.

Table 2 Precautions

Type

Restrictions

Restrictions on subscription objects

  • Only RDS MySQL DB instances are supported.
  • Currently, data subscription objects support only tables.
  • The binlog_row_image format of binlogs must be set to full.
  • MySQL supports only the MyISAM and InnoDB storage engines.
  • MySQL supports only the LATIN1, GBK, UTF8, UTF8MB4, and BINARY character sets.
  • If the DCC does not support instances with 4 vCPUs and 8 GB memory or higher instance specifications, the subscription task cannot be created.

Precautions

  • During data subscription, deleting subscription objects is not allowed.
  • A subscription task can be subscribed to and consumed by only one downstream SDK. If multiple downstream SDKs need to subscribe to the same RDS DB instance, you can create multiple subscription channels. The RDS DB instances subscribed by these subscription tasks have the same instance ID.
  • A downstream SDK cannot subscribe to and consume multiple subscription tasks.

Prerequisites

  • You have logged in to the DRS console.
  • Your account balance is greater than or equal to $0 USD.
  • For details about the supported database types and versions, see Supported Databases.
  • If a subaccount is used to create a DRS task, ensure that an agency has been added. To create an agency, see Agency Management.

Procedure

This section describes how to create a data subscription task on the DRS console.

The following uses MySQL as an example to describe how to create a subscription task. To configure subscription tasks of other DB engines, you can refer to the following procedures.

  1. On the Data Subscription Management page, click Create Subscription Task.
  2. On the Select Subscription Source page, specify Region, Task Name, Description, and subscription source details, and click Next.

    Figure 1 Subscription task information
    Table 3 Task and recipient description

    Parameter

    Description

    Region

    The region where your service is running. You can change the region.

    Task Name

    The task name consists of 4 to 50 characters, starts with a letter, and can contain only letters (case-insensitive), digits, hyphens (-), and underscores (_).

    Description

    The description consists of a maximum of 256 characters and cannot contain special characters !=<>'&"\

    Figure 2 Subscription source information
    Table 4 Subscription source information

    Parameter

    Description

    Instance Type

    Select RDS DB Instance.

    Source DB Engine

    Select MySQL.

    RDS DB instance

    Select an RDS DB instance you have created.

    Enterprise Project

    If the DB instance has been associated with an enterprise project, select the target project from the Enterprise Project drop-down list.

    You can also go to the ProjectMan console to create a project. For details about how to create a project, see ProjectMan User Guide.

    Tags

    This setting is optional. You can use tags to manage subscription tasks. Each task can have up to 10 tags.

    After a task is created, you can view its tag details on the Tags tab. For details, see Tag Management.

  3. On the Select Subscription Object page, wait until the instance is successfully created, select the data subscription object, and click Next.

    Figure 3 Subscription objects
    Table 5 Subscription objects

    Parameter

    Description

    Subscription Type

    Subscription types include data update and structure update.

    • Data update

      Subscribes to the Incremental updates of the selected data.

    • Structure update

      Subscribes to the structure creation, deletion, and modification of all objects in an instance, SDK is needed to filter the required data.

    Subscription Object

    Currently, data subscription objects support only tables. You can select a subscription object based on your service requirements.

    If the source database is changed, click in the upper right corner before selecting migration objects to ensure that the objects to be selected are from the changed source database.

    You can also search for subscription objects to quickly select the required objects.

  4. On the Confirm Task page, specify Send Notifications and SMN Topic, confirm that the configured information is correct, select the check box before the agreement, and click Submit.

    Figure 4 Task startup settings
    Table 6 Task startup settings

    Parameter

    Description

    Send Notifications

    SMN topic. This parameter is optional. If an exception occurs during synchronization, the system will send a notification to the specified recipients.

    SMN Topic

    This parameter is available only after you enable Send Notifications and create a topic on the SMN console and add a subscriber.

    For details, see Simple Message Notification User Guide.

    Synchronization delay threshold

    A synchronization delay indicates a time difference (in seconds) of synchronization between the source and destination database.

    If the synchronization delay exceeds the threshold you specify, DRS will send alarms to the specified recipients. The value ranges from 0 to 3,600. To avoid repeated alarms caused by the fluctuation of delay, an alarm is sent only after the delay has exceeded the threshold for six minutes.

    NOTE:
    • Before setting the delay threshold, enable Send Notification.
    • If the delay threshold is set to 0, no notifications will be sent to the recipient.

  5. After the task is submitted, view and manage it on the Data Subscription Management page.

    • You can view the task status. For more information about task status, see Task Statuses.
    • You can click in the upper-right corner to view the latest task status.

    After a subscription task is created, you can use an SDK to subscribe to incremental data in the subscription task in real time. For details about the operations and precautions, see SDK Operation Instructions.