All Products
Search
Document Center

:Troubleshooting methods for RDS connection failures

更新時間:May 18, 2022

Overview

This article describes how to troubleshoot the failure to connect to an RDS instance. 

Procedure

You can troubleshoot the issue from the following five aspects:

Step 1: Check the instance status and instance connection information

  1. Log on to the apsaradb for RDS console. View the status of the instance in the instance list and confirm the instance status is normal. Troubleshoot issues such as abnormal instance status or being locked. If the instance is locked, see troubleshooting methods for automatic locking of MySQL instances when the instance space is full. While the instance is locked, the application cannot perform read or write operations on the RDS Database. If your business permits, you can try to restart the instance. Proceed with caution.
  2. In the code or tool for connecting to the database, check whether the information for connecting to the database is correct (confirm the intranet and internet address). For more information, see how to connect to RDS Database.

Step 2: Check whether the whitelist is correctly configured

Make sure that you have added the correct local Device IP address to the IP whitelist of the RDS instance. Temporarily add a 0.0.0.0/0 to the whitelist of the database. If the database can be accessed normally after setting the whitelist, it indicates that a problem exists with the whitelist settings. Remove the 0.0.0.0/0 whitelist the right add the IP addresses of the ECS Security Group whitelist takes effect immediately in The. For more information about whitelist considerations, see the following content. For more information about how to add a whitelist, see set whitelist.

  • Since the data security > whitelist in only the default address 127.0.0.1. The default IP address 127.0.0.1 indicates that no devices can access your RDS instance. Therefore, you need to add the IP address of the peer ECS instance to the whitelist.
  • The whitelist is set to 0.0.0.0. The valid format is 0.0.0.0/0.
note: 0.0.0.0/0 indicates that any device is allowed to access the RDS instance. Use it with caution.

Step 3: Check database performance

You can view the performance monitoring information of an RDS instance to determine whether its resources are insufficient.

  • Check the number of connections to the current database.
    1. The full number of connections is usually due to too many idle connections or active connections. See primary instance specification list to confirm the maximum connection data corresponding to the instance specification.
    2. Check whether the connection settings in the code are reasonable and whether most connections are not closed in time, thus consuming RDS resources and finally causing the number of connections to be full. For the causes of and solutions to this problem, see handling the case of full connections on RDS for MySQL or handling the case of full connections on RDS for PostgreSQL.
  • If the business increases normally, we recommend that you upgrade the instance configuration.
    note: there may be a transient disconnection of about 30s during the upgrading process. We recommend that the user do a good job of reconnection mechanism to ensure the normal operation of the user's business. For more information, see RDS usage instructions.
  • Check whether the network traffic is normal and whether there is a high network traffic occupation. If this happens, see view slow log details to view slow logs and optimize slow SQL statements based on the query results.
  • For other performance issues, see resolve high CPU, memory, space, and IOPS usage.

Step 4: Check the client

You can try other ways to connect to the database and confirm if it is the problem of the current client tool. For more information, see connect to MySQL instance.

You cannot access an RDS instance from an ECS instance through the intranet

If the ECS instance cannot access the RDS instance through the intranet, you can see solve the problem of unable to connect to the RDS instance to solve the problem.

Applicability

  • RDS