A PolarDB connection allows you to read data from and write data to ApsaraDB for PolarDB by using PolarDB Reader and Writer. You can configure sync nodes for ApsaraDB for PolarDB by using the codeless user interface (UI) or code editor.

Note Currently, PolarDB connections do not support custom resource groups. Use the default resource group. If you want to use a custom resource group, add a MySQL connection in connection mode. For more information, see Configure a MySQL connection.

Procedure

  1. On the Data Source page, click Add Connection in the upper-right corner.
  2. In the Add Connection dialog box that appears, click PolarDB in the Relational Database section.
  3. In the Add PolarDB Connection dialog box that appears, set the parameters.
    Parameter Description
    Connect To The type of the connection. Set the value to ApsaraDB for PolarDB.
    Connection Name The name of the connection. The name can contain letters, digits, and underscores (_) and must start with a letter.
    Description The description of the connection. The description cannot exceed 80 characters in length.
    Applicable Environment The environment in which the connection is used. Valid values: Development and Production.
    Note This parameter is available only when the workspace is in standard mode.

    Workspaces in standard mode support the connection isolation feature. You can add connections for the development and production environments separately and isolate the connections to protect your data security.

    Cluster ID The ID of the ApsaraDB for PolarDB cluster. You can view the ID in the ApsaraDB for PolarDB console.
    PolarDB Instance Tenant Account ID The ID of the Alibaba Cloud account used to purchase the ApsaraDB for PolarDB instance. You can view your account ID on the Security Settings page after logging on to the Alibaba Cloud console with your Alibaba Cloud account.
    Database Name The name of the database.
    Username The username for logging on to the database.
    Password The password for logging on to the database.
    When you add connections for PolarDB data stores deployed in Virtual Private Clouds (VPCs), note the following information:
    • User-created PolarDB data store
      • You can configure sync nodes that involve such connections. However, connectivity testing is not supported. You can click Complete without testing the connectivity.
      • You must run such sync nodes on custom resource groups. Make sure that the custom resource groups can connect to the data stores.
    • ApsaraDB for PolarDB data store

      You do not need to select the network type, because DataWorks automatically identifies the network type based on the information you enter for the ApsaraDB for PolarDB instance.

  4. Click Test Connection.
  5. After the connectivity test is passed, click Complete.
Note You must add the IP addresses or Classless Inter-Domain Routing (CIDR) blocks that you use to access the ApsaraDB for PolarDB instance to a whitelist of the instance. For more information, see Configure a whitelist.

Note on connectivity testing

  • If the data store is a user-created one deployed on Elastic Compute Service (ECS) instances that reside on a classic network, we recommend that you use a custom resource group to run sync nodes that use the connection. The default resource group does not guarantee that it can connect to the data store over the network.
  • You can add a connection for a PolarDB data store deployed in a VPC based on the ID of the ApsaraDB for PolarDB instance. In this case, the reverse proxy feature is provided to guarantee that the data store can be connected.

What to do next

Now you have learned how to configure a PolarDB connection. You can proceed with the next tutorial. In the next tutorial, you will learn how to configure PolarDB Reader and Writer. For more information, see Configure PolarDB Reader and Configure PolarDB Writer.