This topic describes how to use Data Management (DMS) or a client to connect to a PolarDB database cluster.
Use DMS to connect to a PolarDB cluster
DMS provides an integrated solution for data management. DMS supports data management, schema management, access security, BI charts, data trends, 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. You can also use DMS to manage Linux servers.
- Log on to the PolarDB console.
- In the upper-left corner of the console, select the region where the cluster resides.
- Find the cluster, and then click the cluster ID.
- In the upper-right corner of the Overview page, click Log On to Database.
- In the dialog box that appears, enter the database account and password that you create in the PolarDB cluster.
- Click Login.Note If you use DMS to connect to a PolarDB cluster for the first time, the system prompts you to add the IP address of DMS to the database whitelist. Click Configure Whitelist to authorize DMS.
- After you log on to the database, refresh the page. In the left-side navigation pane, click Logged in instance.
- Find the database that you want to manage and double-click the database name to view the database details.
Use a client to connect to a PolarDB cluster
You can also use the pgAdmin 4 client to connect to a PolarDB cluster.
- Start the pgAdmin 4 client.
- Right-click Servers and choose , as shown in the following figure.
- On the General tab of the create-server page, enter the name of the server.
- Click the Connection tab and specify the information of the cluster to be connected. The following table
describes the parameters.
Table 1. Parameters Parameter Description Host name/address
Enter the endpoint of the PolarDB cluster. To view the endpoint and port information of the PolarDB cluster, perform the following steps:
- Log on to the PolarDB console.
- In the upper-left corner of the console, select the region where your cluster is deployed.
- On the Clusters page, click the ID of the cluster that you want to view.
- In the Endpoints section, view the endpoint of the PolarDB cluster.
Port Enter the port of the PolarDB-O cluster. Default value: 1521. Maintenance database Enter the name of 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 account password of the PolarDB cluster.
- Click Save.
- If the connection information is valid, the following page appears after you click
the database name. This indicates that the connection is established.
- Right-click the database that you want to manage and click Query Tool.... The following page appears. Then, you can add, delete, modify, or query data in
Use a command line tool to connect to a PolarDB-O cluster
In addition to the preceding methods to connect to a PolarDB database cluster, you can also download and install a client and use the command line tool to connect to a PolarDB database cluster.
- The IP address whitelist is invalid.
- The whitelist contains only the default IP address 127.0.0.1. 127.0.0.1 indicates that no IP address is allowed to connect to the PolarDB cluster. Therefore, you must add IP addresses to the whitelist. For more information, see Configure a whitelist for a cluster.
- You have added 0.0.0.0 to the whitelist. However, the correct format is 0.0.0.0/0.
Notice The CIDR block 0.0.0.0/0 indicates that all IP addresses are allowed to connect to the PolarDB cluster. Proceed with caution when you add this CIDR block to the whitelist.
- The public IP address you add to the whitelist may not be the actual IP address of the server that connects to the database cluster. For example, the public IP address may be a dynamic IP address. The tools or websites used to query public IP addresses provide invalid IP addresses.
- The private or public IP address is used in an invalid manner.
The connection fails if you use a private IP address to connect to a cluster over the Internet or use a public IP address to connect to a cluster over an internal network.
Use an IP address in a valid manner to connect to a cluster. If you want to connect to the PolarDB cluster over an internal network, use a private IP address of the PolarDB cluster. If you want to connect to the PolarDB cluster over the Internet, use a public IP address of the PolarDB cluster.
- A Domain Name System (DNS) server fails to resolve an IP address.
- If you enter an invalid IP address of a PolarDB-O cluster, check whether one of the
following situations occur:
- You enter an invalid IP address of the cluster. In this case, you can view the valid IP address in the console. For more information about how to view an IP address, see Procedure.
- You use a public IP address to connect to the cluster. However, the IP address is deleted.
- Some applications have limits on the length of IP addresses and the IP address you enter is truncated.
- If the IP address of the PolarDB-O cluster is valid, you can change the IP address
of the DNS server to that of the Alibaba Cloud DNS server.
Network type IP address of the Alibaba Cloud DNS server Internal network (classic network) 10.143.22.116
Internal network (virtual private cloud) 100.100.2.136
- If you enter an invalid IP address of a PolarDB-O cluster, check whether one of the following situations occur: