Help Center> GaussDB> FAQs> Database Connections> What Should I Do If I Can't Connect to My GaussDB Instance?
Updated on 2024-05-07 GMT+08:00

What Should I Do If I Can't Connect to My GaussDB Instance?

Problem Analysis

Locate the fault by considering the following aspects:

  1. Check whether the DB instance is available.

    For example, the system is faulty, the DB instance is abnormal, or the DB instance or a table is locked.

  2. (Common) Check whether the client connection is correct.
    • If you connect to an instance over a private network, ensure that the instance and ECS are in the same region and VPC.
    • If you connect to an instance over a public network, bind an EIP to the instance and then connect to the instance through the EIP.
  3. Check whether the parameters in the connection command are correct.

    Check whether the following parameters are configured correctly: connection address, port number, username, and password.

  4. (Common) Check whether the network connectivity is normal.
    For a private network connection:
    1. Ensure that the ECS and GaussDB instance are in the same region and VPC.
    2. Check security group rules.

      To access GaussDB instances in a security group from a public network, add an inbound rule.

    3. On the ECS, check whether the GaussDB instance port can be connected.
    For a public network connection:
    1. Check security group rules.

      To access GaussDB instances in a security group from a public network, add an inbound rule.

    2. Check network ACL rules.
    3. Ping the ECS to the instance in the same region.
  5. (Common) Check whether the DB instance is in the Storage full state.

    If the DB instance is in the Storage full state, data read and write performance is affected.

  6. View common connection error messages.

    Find corresponding solutions based on connection error messages.

Troubleshooting Process

Figure 1 Locating instance connection failures
  1. Check whether the DB instance is available.

    Check method: Check whether the DB instance is in the Available state.

    Possible cause: If the system is faulty, the DB instance is abnormal, or the DB instance or a table is locked.

    Solution: If the DB instance is abnormal, reboot it.

    Figure 2 Checking DB instance status
  2. Check whether the client connection is correct.

    For details about how to connect to a DB instance over a private or public network, see Can an External Server Access GaussDB Instances?

    Table 1 Connection methods

    Connect Through

    Description

    Example

    Private network

    A private IP address is provided by default.

    If your applications are deployed on an ECS that is in the same region and VPC as your DB instance, use a private IP address to connect to the ECS and the DB instance.

    For example, to connect to the postgres database, run the following command:

    gsql -d postgres -h 10.0.0.0 -U root -p 8000

    NOTE:

    postgres indicates the database name, 10.0.0.0 indicates the CN IP address of a distributed DB instance or the primary DN IP address of a primary/standby DB instance, root is the username for logging in to the database, and 8000 is the port number of the CN.

    Public network

    If you cannot access a GaussDB instance over a private IP address, bind an EIP to the GaussDB instance and connect it to the ECS (or a host from the public network) over the EIP.

    For example, to connect to the postgres database, run the following command:

    gsql -d postgres -h 10.0.0.0 -U root -p 8000

    NOTE:

    postgres is the name of the database to be connected; 10.0.0.0 is the EIP bound to the DB instance; root is the username for logging in to the database; 8000 is the port number of the DB instance.

  3. Check whether the parameters in the connection command are correct.

    Ensure that the connection address, port, username, and password are correct, and try to connect to the instance again.

    Connection through a private network
    1. Connection address

      Private IP Address in the Connection Information area of the Basic Information page of the target instance

      Figure 3 Private IP address
    2. Database port

      Database Port of the target instance

    3. Username and password

      User root and its password

    Connection through a public network
    1. Connection address

      EIP in the Connection Information area of the Basic Information page of the target instance

      Figure 4 EIP
    2. Database port

      Database Port of the target instance

    3. Username and password

      User root and its password

  4. Check the network connection.
    Private network connection
    1. Check whether the ECS and GaussDB instance are in the same region and VPC.
      Figure 5 Viewing the VPC of an ECS
      Figure 6 Viewing the VPC of a GaussDB instance
    2. Check security group rules.
      • If Destination is not 0.0.0.0/0 and Protocol & Port is not All on the Outbound Rules page of the ECS, add the private IP address and port of the GaussDB instance to the outbound rules.
        Figure 7 ECS security group
      • If Source is not 0.0.0.0/0 and Protocol & Port is not All on the Inbound Rules page of the GaussDB instance, add the IP address and port of the ECS to the inbound rules.
        Figure 8 GaussDB security group
    3. On the ECS, check whether the GaussDB instance port can be connected.
      telnet <IP address> <port number>
      • If the ECS can connect to the DB instance, the network between them is normal.
      • If the ECS cannot connect to the DB instance, choose Service Tickets > Create Service Ticket in the upper right corner of the management console to submit a service ticket for help.
    Public network connection
    1. Check security group rules.
      • If Destination is not 0.0.0.0/0 and Protocol & Port is not All on the Outbound Rules page of the ECS, add the public IP address and port of the GaussDB instance to the outbound rules.
        Figure 9 ECS security group
      • If Source is not 0.0.0.0/0 and Protocol & Port is not All on the Inbound Rules page of the GaussDB instance, add the IP address and port of the ECS to the inbound rules.
        Figure 10 GaussDB security group
    2. Check network ACL rules.
      1. Go to the Network ACLs page.
      2. Check whether the NIC bound to the EIP is in the subnet associated with the network ACL.
      3. Check whether the network ACL is enabled.

        If it is enabled, add an ICMP rule to allow traffic.

      The default network ACL rule denies all inbound and outbound packets. This default rule is still applied even if the network ACL is disabled.

    3. Ping the ECS to the instance in the same region.

      If you cannot ping the EIP on the original ECS, select another ECS in the same region and ping the EIP again. If the ping is successful, the virtual network is functional. In this case, choose Service Tickets > Create Service Ticket in the upper right corner of the management console to submit a service ticket for help.

  5. Check whether the DB instance is in the Storage full state.

    Check method: View the storage space usage on the console or Cloud Eye.

    • On the management console

      Locate the target instance and click its name to go to the Basic Information page. In the Storage/Backup Space area, view the storage space usage.

      Figure 11 Checking the disk usage
    • On Cloud Eye

      Locate the target instance and click View Metric in the Operation column. On the displayed page, view the storage space usage.

      Possible cause: If the kernel system detects that the disk usage exceeds the specified threshold, the instance is set to read-only and no data can be written to the DB instance.

      Solution: See Scaling Up Storage Space.

  6. View common connection error messages.

    When you run commands to connect to a DB instance, the possible error and solution are provided in the following:

    gsql: ERROR: dn_6001_6002_6003: Invalid username/password,login denied.

    If this error message is displayed when you attempt to connect to a GaussDB instance, check whether the username or password is correct.

  7. If the problem persists, create a service ticket to contact customer service for help.

Database Connections FAQs

more