1.1.1. Database Connection
Does the instance support changing VPCs?
RDS-PostgreSQL supports replacing VPCs through the Console.
Does RDS-PostgreSQL support cross-regional Intranet access?
Cross-regional Intranet access is not supported by default because cloud services in different regions cannot communicate with each other over an Intranet. You can achieve access through the public network, or achieve an Intranet network through a cloud connection or using a VPN to connect networks.
To access an instance across regions, you can bind an EIP for the instance. For details, see Connecting to an Instance with the psql Command Through a Public Network.
How do I access an RDS-PostgreSQL database within a VPC through an external server or application?
Instances With Public Network Access Enabled
For cloud database instances that have enabled the public network access function, you can access them through an external network.
For specific connection methods, see Connecting to an Instance Through a Public Network.
Instances With Public Network Access Not Enabled
For cloud database instances that have not enabled the public network access function, you can only access them through the Intranet under the same AZ and VPC.
For specific connection methods, see Connecting to an Instance Through an Intranet.
Why cannot I ping my public network IP after it is bound to an instance?
The troubleshooting method is as follows:
1. Check security group rules.
2. Ping the affected WAN IP from another ECS in the same region.
For specific configuration methods of the security group, see Security Group Configuration Example.
Do applications need to support automatic reconnection to databases?
We recommend that your applications support automatic reconnection to databases. In the event of a database connection fault or disconnection, the applications can automatically reconnect to the database, thus improving the availability and stability of the system. In addition, a persistent connection is recommended to reduce frequent connection and disconnection operations, thus reducing resource consumption and improving system performance.
Is the Elastic Cloud Server (ECS) access to RDS-PostgreSQL through an Intranet limited by bandwidth?
The access to ECS and RDS-PostgreSQL through an Intranet is not limited by bandwidth. However, the public network access bandwidth is limited based on the bandwidth of the EIP product you bind.
How do I view all IPs connected to a database at the current time?
To view all IPs connected to the current instance, you can connect to the instance and execute the following SQL statements from the database command line to view the number of all active IPs.
SELECT client_addr FROM pg_stat_activity WHERE state = 'active';
1.1.2. Basic Usage of Database
How do I view the session ID of the current connected database and the login time?
Execute the following command in the database, where Process ID (PID) is the connected session ID, and backend_start is the login time for the connection.
select pid, backend_start from pg_stat_activity;
Why did the new password not take effect after I reset the password?
Possible Causes: You may have restored from a backup before you reset the password.
Locating Method: Check whether the instance was restored after you reset the password.
Solution: On the Console Instance Details page, reset the password again. For details, see Resetting the Administrator (Root Account) Password.
Is RDS-PostgreSQL still available during disk expansion, series expansion, and specification change scenarios?
RDS-PostgreSQL supports a variety of scenarios including disk expansion, series expansion, and specification changes. The impact of the above scenarios on RDS-PostgreSQL availability is as follows:
• During disk expansion and series expansion scenarios, the RDS instance service is still available and your businesses are not affected. However, you cannot unsubscribe from, renew, or restart the instance.
• During CPU/memory specification changes, services may become unavailable for 5 to 15 minutes. After modifying CPU/memory, the database will be restarted. To avoid affecting your businesses, please operate during off-peak hours.
Can I access an RDS-PostgreSQL standby instance?
The RDS-PostgreSQL database supports the high-availability mode with one master node and one standby node. In this mode, the primary instance can be accessed, but the standby instance cannot be directly accessed. The standby instance is only used for master-slave switching to achieve high availability of the database.
The RDS-PostgreSQL standby instance supports switching with the primary instance. After switching, the original standby instance becomes the primary instance, and the data of the primary/standby instances will be synchronized in real time.
How do I install a PostgreSQL client?
PostgreSQL provides different versions of client installation packages for different operating systems on its official website. You can select and use desired clients according to your needs. The following describes how to install a PostgreSQL 12 client on the ECS and access the instance database using the CentOS Elastic Cloud Server (ECS) as an example.
1. Open the client download page on the PostgreSQL official website.
2. Select a database version, operating system, and operating system architecture, and execute the following commands to install the PostgreSQL client on the ECS.
sudo yum install -y For the PostgreSQL official website, visit /pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm sudo yum install -y postgresql12-server
3. Log in to the system and connect an instance.
Before connecting to the database, make sure that your ECS and RDS-PostgreSQL instances are under the same VPC and configure the security group to release the corresponding port of the database, thus ensuring a smooth network.
Execute the following command on the ECS to log in to the connection instance, where username is the username of the instance, host is the IP of the instance, port is the connection port of the instance, and dbname is the database of the instance. After executing this command, follow the prompt to enter the password of the database account to log in to the connection instance.
psql -U username -h host -p port -d dbname
1.1.3. Database Data Immigration
Why do I need to use the pg_dump tool for migration?
This solution is simple and easy to operate. It is suitable for scenarios when there is not much data to migrate or when stopping the service for a long period is allowed. Make sure that the migration can be completed within this period. The disadvantage is that the server may be stopped for a long period, which may affect your business RDS-PostgreSQL is fully compatible with the open-source PostgreSQL version. For users, the procedure for migrating data from an original database to RDS-PostgreSQL is similar to the procedure for migrating from one database server to another.
What types of database engine data does RDS-PostgreSQL support for importing?
• Homogeneous database import or export is supported: That is data import and export between engine databases of the same type.
• Heterogeneous database import or import is not supported: That is data import and export between engine databases of different types. For example, import data from Oracle to database engines supported by RDS-PostgreSQL. Third-party software is usually required for data replication to achieve heterogeneous database import or import.