This topic describes how to create a database link from a PolarDB for PostgreSQL(Compatible with Oracle) cluster to a self-managed PostgreSQL database hosted on an Elastic Compute Service (ECS) instance.
For more information about how to create a database link from a PolarDB for PostgreSQL(Compatible with Oracle) cluster to a PolarDB for PostgreSQL(Compatible with Oracle) cluster, see Create a database link from PolarDB for PostgreSQL(Compatible with Oracle) to PolarDB for PostgreSQL(Compatible with Oracle).
Prerequisites
- The PolarDB for PostgreSQL(Compatible with Oracle) cluster and the self-managed PostgreSQL database hosted on the ECS instance belong to the same Alibaba Cloud account.
- The ECS instance is deployed in a virtual private cloud (VPC).
- The kernel version of the PolarDB for PostgreSQL(Compatible with Oracle) cluster is the latest kernel version. For information about how to upgrade the kernel version, see Version Management.
- A database link is created from the PolarDB for PostgreSQL(Compatible with Oracle) cluster to the self-managed PostgreSQL database hosted on the ECS instance.
Precautions
You can create a maximum of 10 database links for each PolarDB for PostgreSQL(Compatible with Oracle) cluster. Each database link consumes one database link quota of both the source cluster and the destination cluster.
Procedure
- Log on to the PolarDB console.
- In the upper-left corner of the console, select the region in which the cluster that you want to manage is deployed.
- Find the cluster and click the cluster ID.
- In the left-side navigation pane, choose .
- On the Databases page, click the DBLinks tab in the upper part.
- Click Create DBLink and configure the following parameters.
Parameter Description DBLink Name You can enter a custom name of the database link. The name must meet the following requirements: - The name must contain lowercase letters and can contain digits and underscores (_).
- The name must start with a lowercase letter and end with a lowercase letter or a digit.
- The token can be up to 64 characters in length,
This name is required when you use the database link for cross-database queries.
Source Instance Name The name of the current PolarDB for PostgreSQL(Compatible with Oracle) cluster is used as the fixed value. You cannot modify this parameter. Source Database Name Select a database in the current PolarDB for PostgreSQL(Compatible with Oracle) cluster from the drop-down list. VPC of Destination Instance The VPC where the ECS instance resides. You can view the VPC ID of the destination ECS instance in the Network Information section on the Basic Information page in the ECS console.
Region ID of Destination Instance The region ID of the ECS instance, such as cn-hangzhou. You can call the DescribeInstances operation to query the region ID of the destination ECS instance.
VPC ID of Destination Instance The IP address of the ECS instance. You can view the primary private IP address of the destination ECS instance in the Network Information section on the Basic Information page in the ECS console.
VPC Port of Destination Instance The port number of the self-managed PostgreSQL database hosted on the ECS instance. Default value: 1521. Destination Account The account used to log on to the self-managed PostgreSQL database hosted on the ECS instance. Destination Account Password The password used to log on to the self-managed PostgreSQL database hosted on the ECS instance. Destination Database Name The name of the self-managed PostgreSQL database hosted on the ECS instance. - Click OK.
Related operations
API | Description |
---|---|
CreateDBLink | Creates a database link for a PolarDB for PostgreSQL(Compatible with Oracle) cluster. |
DescribeDBLinks | Queries the database link information of a PolarDB for PostgreSQL(Compatible with Oracle) cluster. |