Before you synchronize data from PolarDB to Elasticsearch, you can refer to the operations in this topic to prepare configurations, such as network environments and whitelists, for the data sources.

Prerequisites

Before you configure a data source, make sure that the following operations are performed:
  • Prepare data sources: A source PolarDB for MySQL cluster and a destination Elasticsearch cluster are prepared. In this topic, a PolarDB for MySQL cluster is used as the source.
  • Plan and prepare resources: An exclusive resource group for Data Integration is purchased and configured. For more information, see Plan and configure resources.
  • Evaluate and plan the network environment: Before you perform data integration, connect data sources to exclusive resource groups for data integration based on your business requirements. After data sources and exclusive resource groups for data integration are connected, you can refer to the operations in this topic to configure access settings such as vSwitches and whitelists.
    • If data sources and exclusive resource groups for data integration reside in the same region and virtual private cloud (VPC), they are automatically connected.
    • If data sources and exclusive resource groups for data integration reside in different network environments, you must connect data sources and resource groups by using methods such as a VPN gateway.

Background information

Before you synchronize data from the source to the destination, make sure that the data sources and exclusive resource groups for Data Integration are connected. In addition, you must create an account and authorize the account to access the data sources.
  • Configure whitelists for the data sources
    If the data sources and exclusive resource group for Data Integration reside in the same VPC, you must add the CIDR block of the exclusive resource group for Data Integration to the whitelists of the data sources. This ensures that the exclusive resource group for Data Integration can be used to access the data sources. VPC connection
  • Create an account and authorize the account

    You must create an account that can be used to access data sources, read data from the source data source, and write data to the destination data source in the data integration process.

  • Enable the binary logging feature

    If the source data source is a PolarDB for MySQL cluster, you must enable the binary logging feature for the cluster. Alibaba Cloud PolarDB for MySQL is fully compatible with MySQL and uses high-level physical logs to replace binary logs. To facilitate the integration between PolarDB and the MySQL ecosystem, you can enable the binary logging feature for PolarDB clusters.

Limits

  • Only PolarDB for MySQL clusters can be used as source data sources. In this topic, PolarDB indicates PolarDB for MySQL data sources.
  • Only data stored on the primary node of the PolarDB cluster can be synchronized.

Procedure

  1. Configure a whitelist for the PolarDB cluster.
    Add the CIDR block of the VPC where the exclusive resource group resides to the whitelist of the PolarDB cluster.
    1. View and record the elastic IP address (EIP) and CIDR block of the exclusive resource group.
      1. Log on to the DataWorks console.
      2. In the left-side navigation pane, click Resource Groups.
        • Obtain the CIDR block of the vSwitch to which the exclusive resource group is bound.

          To synchronize data to or from a data source in a VPC, you must obtain and add the CIDR block of the vSwitch to which the exclusive resource group is bound to the whitelist of the data source. To obtain the vSwitch CIDR block, perform the following steps:

          On the Exclusive Resource Groups tab, find your desired resource group and click Network Settings in the Actions column. On the page that appears, obtain the vSwitch CIDR block and add it to the whitelist of the data source. vSwitch CIDR block
        • Obtain the EIP and CIDR block of the exclusive resource group.

          To synchronize data over the Internet, you must obtain and add the EIP and CIDR block of the exclusive resource group to the whitelist of the data source. To obtain the EIP and CIDR block, perform the following steps:

          On the Exclusive Resource Groups tab, find your desired resource group and click View Information in the Actions column. In the Exclusive Resource Groups dialog box, click to copy the values of the EIPAddress and CIDR Blocks parameters. Then, add the values to the whitelist of the data source. EIP
    2. Add the EIP and CIDR block of the exclusive resource group to the whitelist of the PolarDB cluster.
      Whitelist of the PolarDB clusterFor more information, see Configure an IP whitelist.
  2. Create an account and grant the required permissions to the account.
    You must create an account to log on to the database of the PolarDB cluster. You must grant the SELECT, REPLICATION SLAVE, and REPLICATION CLIENT permissions to the account.
    1. Create an account.
      For more information, see Create a database account.
    2. Grant permissions to the account.
      You can run the following command to grant permissions to the account, or you can directly grant the SUPER permission to the account.
      -- CREATE USER 'Account for data synchronization'@'%' IDENTIFIED BY 'Account for data synchronization';
      GRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT ON *. * TO 'Account for data synchronization'@'%';
  3. Enable the binary logging feature for the PolarDB cluster.
    For more information, see Enable binary logging.

What to do next

After data sources are configured, the source data source, destination data source, and exclusive resource group for data integration are connected. Then, the exclusive resource group for data integration can be used to access data sources. You can add the source data source and destination data source to DataWorks, and associate them with a data synchronization solution when you create the solution.

For more information about how to add a data source, see Add data sources.