This topic describes how to connect to a PolarDB for PostgreSQL cluster.

Use DMS to connect to a PolarDB for PostgreSQL cluster

Data Management (DMS) provides an integrated solution for data management. DMS supports data management, schema management, access control, BI charts, trend analysis, data tracing, performance optimization, and server management. DMS supports relational databases such as MySQL, SQL Server, and PostgreSQL, as well as NoSQL databases such as MongoDB and Redis. DMS also supports the management of Linux servers.

Prerequisites

You have created a privileged or standard account for an existing database cluster. For more information, see Create a database account.

Procedure

  1. Find the target cluster and click the cluster ID to go to the basic information page.
  2. Click Log On to Database in the upper-right corner of the page.
    Log On to Database
  3. On the database logon page, enter the endpoint and the port number, and separate them with a colon (:). Then enter the username and the password of the privileged or standard account, and click Log On.
    Note DMS logon only supports the endpoint and does not support the cluster address.

    For more information about how to view the endpoint, see View connection endpoints.

    RDS Database Logon

Use a client to connect to a PolarDB for PostgreSQL cluster

PolarDB for PostgreSQL does not support setting a whitelist for a cluster. Only instances that are in the same VPC can access the cluster. Therefore, the server where the client resides and the PolarDB compatible with Oracle cluster must be in the same VPC.

  1. Start the pgAdmin 4 client.
  2. Right-click Servers and choose Create > Server from the shortcut menu, as shown in the following figure.
  3. On the General tab of the Create - Server dialog box, enter the name of the server, as shown in the following figure.
  4. Click the Connection tab and enter the information of the instance to connect to, as shown in the following figure.

    Parameter description:

    • Hostname or IP Address: the internal IP address of the PolarDB for PostgreSQL cluster. To view the endpoint and port information of the PolarDB for PostgreSQL cluster, follow these steps:

      1. Log on to the ApsaraDB for PolarDB console.
      2. Find the target cluster and click the cluster ID.
      3. In the Connection Information section, view the endpoint and port information.
    • Port: the internal port of the PolarDB for PostgreSQL cluster.
    • User Name: the name of the privileged account of the PolarDB for PostgreSQL cluster.
    • Password: the password of the privileged account of the PolarDB for PostgreSQL cluster.
  5. Click Save.
  6. If the connection information is correct, choose Servers > Server Name > Databases > postgres. The connection is successful if the following interface is displayed.
    Note postgres is the default system database of the PolarDB for PostgreSQL cluster. Do not perform any operation on the database.