This topic describes how to use Data Management Service (DMS) and a client to connect to a ApsaraDB PolarDB PostgreSQL-compatible edition cluster.

Prerequisites

  • A privileged account or a standard account for a PolarDB cluster is created. For more information, see Create database accounts.
  • The IP address of the host that you want to connect to the PolarDB cluster is added to the whitelist. For more information, see Configure a whitelist for a cluster.

Use DMS to connect to a PolarDB cluster

DMS provides an integrated data management solution. DMS supports data management, schema management, access control, BI charts, trend analysis, data tracking, performance optimization, and server management. DMS allows you to manage relational databases such as MySQL, SQL Server, and PostgreSQL, as well as NoSQL databases such as MongoDB and Redis. DMS also allows you to manage Linux servers.

  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster is deployed.
  3. Find the cluster and click the cluster ID.
  4. In the upper-right corner of the Overview page, click Log On to Database.
  5. In the dialog box that appears, enter the database account and password that you create in the PolarDB cluster.
    Use DMS to connect to a PolarDB cluster
  6. Click Login.
    Note If you are using DMS to connect to the PolarDB cluster for the first time, you are prompted to set the whitelist. Click Configure Whitelist to complete the authorization.
  7. After you log on to DMS, refresh the page. In the left-side navigation pane, click Logged in instance.
  8. Find and double-click the name of the database that you want to manage. Then, you can manage the database.

Use a client to connect to a PolarDB cluster

You can also use your pgAdmin 4 client to connect to a PolarDB cluster.

  1. Launch the pgAdmin 4 client.
  2. Right-click Servers and choose Create > Server, as shown in the following figure.
    Create a server
  3. On the General tab of the Create - Server dialog box, enter the name of the server, as shown in the following figure.
    pgAdmin 4 - General
  4. Click the Connection tab and specify the information about the cluster that you want to connect to. The following table describes the parameters.
    pgAdmin 4 - Connection
    Table 1. Parameter description
    Parameter Description
    Host name/address

    The endpoint of the PolarDB cluster. To view the endpoint and port information about the PolarDB cluster, perform the following steps:

    1. Log on to the PolarDB console.
    2. In the upper-left corner of the console, select the region where the cluster is deployed.
    3. On the Clusters page, click the ID of the cluster that you want to manage.
    4. In the Endpoints section, view the endpoints of the PolarDB cluster.
    Port The port for the ApsaraDB PolarDB PostgreSQL-compatible edition cluster. Default value: 1921.
    Maintenance database The maintenance database. Default value: postgres.
    Username The account of the PolarDB cluster. For more information about how to create an account, see Create database accounts.
    Password The password of the account for the PolarDB cluster.
  5. Click Save.
  6. If the connection information is valid, a page that is similar to the following page appears after you click the database name. This indicates that the database is connected.
    Connection established
  7. Right-click the name of the database that you want to manage and click Query Tool.... On the page that appears, you can add, delete, update, and query data in the database.
    Query editor