This topic describes how to use DMS or a client to connect to a PolarDB-O cluster.

Prerequisites

Use DMS to connect to a PolarDB-O 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.

  1. Login ApsaraDB for PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster is located.
  3. Find the target cluster and click the cluster ID.
  4. In the upper right corner of the Overview page, click Log On to Database to go to the RDS Database Logon page.
    Use DMS to connect to a PolarDB-O cluster
  5. On the RDS Database Logon page, enter the primary endpoint and the port number, and separate them with a colon (:). Then, enter the username and password of the privileged or standard account, and click Log On.
    When you connect to a cluster by using DMS, you can only use a primary endpoint. DMS does not support cluster endpoints.

Use a client to connect to a PolarDB-O cluster

You can also use the pgAdmin 4 client to connect to an Apsara 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 that appears, enter the name of the server, as shown in the following figure.
    pgadmin4-General
  4. Click the Connection tab and specify the information of the destination instance. These parameters are listed in the following table.
    pgadmin-Connection
    Table 1. Parameters
    Parameter Description
    Host name/address

    Enter the endpoint of the PolarDB-O cluster. To view the endpoint and port information of the PolarDB-O cluster, perform the following steps:

    1. Log on to the Apsara PolarDB console.
    2. In the upper-left corner of the console, select the region where the cluster is deployed.
    3. Find the target cluster and click the cluster ID.
    4. In the Endpointssection, view the endpoint and port information.
    Port The port of the cluster. Default value: 1521.
    Maintenance database Enter the maintenance database. Default value: postgres.
    Username The username of the account of the PolarDB-O cluster. For more information, see Create a database account.
    Password The password of the account for the PolarDB-O cluster.
  5. Click Save.
  6. If the connection information is valid, the following page appears after you click the database name. This indicates that the connection is established.
    Connection established
  7. Right-click the target database and click Query Tool.... On the following page, you can add, delete, update, and query data in the database.
    Query Editor

Use command lines to connect to a PolarDB-O cluster

In addition to the preceding methods, you can also download and install a client and use the CLI tool to connect to a PolarDB-O cluster.

Next

Basic operations of PolarDB-O

Troubleshooting

  • The IP address whitelist is invalid.
    • The default whitelist contains only the IP address 127.0.0.1. 127.0.0.1 indicates that no IP address is allowed to access the cluster. Therefore, you must add IP addresses to the whitelist. For more information, see Set IP address whitelists for a cluster.
    • You have added 0.0.0.0 to the whitelist. The required format is 0.0.0.0/0.
      Notice The CIDR block 0.0.0.0/0 indicates that all IP addresses are allowed to access the cluster. Use this CIDR block with caution.
    • The public IP addresses you add to the whitelist are invalid. For example, the public IP address may be a dynamic IP address. The tools or websites used to query the public IP addresses provide invalid incorrect IP addresses.
  • The internal or public endpoint is incorrectly used in the corresponding network.

    The connection fails when you use an internal endpoint to connect over the Internet or use a public endpoint to connect over an internal network.

    Use the required endpoint. If you want to connect to an Apsara PolarDB cluster over an internal network, you must use an internal endpoint. If you need to connect to the cluster over the Internet, you must use a public endpoint.