Esta página ainda não está disponível no idioma selecionado. Estamos trabalhando para adicionar mais opções de idiomas. Agradecemos sua compreensão.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ GaussDB(DWS)/ Troubleshooting/ Database Connections/ An Error Indicating Too Many Client Connections Is Reported When a User Connects to a GaussDB(DWS) Database

An Error Indicating Too Many Client Connections Is Reported When a User Connects to a GaussDB(DWS) Database

Updated on 2025-01-06 GMT+08:00

Symptom

An error indicating too many client connections is reported when a user connects to a GaussDB(DWS) database.

  • When a user uses an SQL client tool, such as gsql, to connect to a database, the following error information is displayed:
    1
    FATAL: Already too many clients, active/non-active/reserved: 5/508/3.
    
  • When the user uses multiple clients to concurrently connect to the database, the following error information is displayed:
    1
    2
    [2019/12/25 08:30:35] [ERROR] ERROR: pooler: failed to create connections in parallel mode for thread 140530192938752, Error Message: FATAL:  dn_6001_6002: Too many clients already, active/non-active: 468/63.
    FATAL: dn_6001_6002: Too many clients already, active/non-active: 468/63.
    

Possible Causes

  1. The number of current database connections exceeds the upper limit.

    In the error information, the value of non-active indicates the number of idle connections. For example, if the value of non-active is 508, there are 508 idle connections.

  2. The upper limit of connections is set when the user is created.

    If the number of connections does not reach the upper limit, the possible cause is that the maximum number of connections is set when the user is created.

Handling Procedure

You can first use the following methods to rectify the fault:

  1. Release all non-active connections temporarily.
    1
    SELECT PG_TERMINATE_BACKEND(pid) from pg_stat_activity WHERE state='idle';
    
  2. On the GaussDB(DWS) management console, set parameter session_timeout, which controls the timeout period of idle sessions. After an idle session's timeout period exceeds the specified value, the server automatically closes the connection.

    The default value of parameter session_timeout is 600 seconds. The value 0 indicates that the timeout limit is disabled. You are not advised to set session_timeout to 0.

    The procedure for setting parameter session_timeout is as follows:

    1. Log in to the GaussDB(DWS) management console.
    2. In the navigation tree on the left, click Cluster Management.
    3. In the cluster list, find the target cluster and click its name. The Basic Information page is displayed.
    4. Click the Parameter Modifications tab and modify the value of parameter session_timeout. Then click Save.
    5. In the Modification Preview dialog box, confirm the modification and click Save.

If the preceding methods cannot meet service requirements, perform the following operations:

If the number of database connections exceeds the maximum, perform the following operations:

  1. Check where the connections on the CN come from, the total number of connections, and whether the number of connections exceeds the value of max_connections. The default value is 800 for CNs and 5000 for DNs.
    1
    SELECT coorname, client_addr, count(1) FROM pgxc_stat_activity group by coorname, client_addr order by coorname;
    
  2. Check whether the value of max_connections can be increased. The adjustment principle is as follows:
    • Increasing the value of max_connections for CNs will increase the number of concurrent queries connected to DNs. Therefore, you need to increase the values of max_connections and comm_max_stream for DNs,
    • Increase the max_connections value of CNs/DNs by two times. For clusters with small values, increase it by four times.
    • To avoid failures in the preparation step, the value of max_prepared_transactions cannot be smaller than that of max_connections. You are advised to set max_prepared_transactions to a value equal to that of max_connections. In this way, each session can have a prepared transaction in waiting state.
  3. Change the value of max_connections on the management console.

    On the management console, choose Basic Information, click the Parameter Modification tab, change the value of max_connections, and click Save.

If the maximum number of connections of a user is set, perform the following operations:

The value is specified by the CONNECTION LIMIT connlimit parameter of the CREATE ROLE command used when a user is created. After the value is specified, you can also change it through the CONNECTION LIMIT connlimit parameter of the ALTER ROLE command.

  1. Use PG_ROLES to check the maximum number of connections of a specified user.
    1
    2
    3
    4
    5
    SELECT ROLNAME,ROLCONNLIMIT FROM PG_ROLES WHERE ROLNAME='role1';
     rolname | rolconnlimit
    ---------+--------------
     role1   |           10
    (1 row)
    
  2. Change the maximum number of connections of a user.
    1
    ALTER ROLE role1 connection limit 20;
    

Usamos cookies para aprimorar nosso site e sua experiência. Ao continuar a navegar em nosso site, você aceita nossa política de cookies. Saiba mais

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback