繁体   English   中英

postgres 监听通知生成错误 - 53300:抱歉,已经有太多客户端

[英]postgres listen notification generates error - 53300: sorry, too many clients already

在来自 postgres 触发器的监听通知期间,我们遇到错误 53300: sorry, too many clients already。 请建议,如果我们能以某种方式解决它。 在关闭连接 object 时,它会停止发送通知。 我们正在使用 Signal R 接收通知。

public async Task BrokerConfig()
{
    var con = new NpgsqlConnection("host=x.x.x.x;Port=5432;Database=Ticket;User Id=someid;Password=pwd;Connection Idle Lifetime=0;Timeout=0;;Command Timeout=0;");

    con.Notification += LogNotificationHelper;
    con.Open();
    using (var cmd = new NpgsqlCommand())
    {
        cmd.CommandText = "LISTEN notifytickets;";
        cmd.CommandType = CommandType.Text;
        cmd.Connection = con;
        cmd.ExecuteNonQuery();
    }

    
        // Waiting for Event
        con.WaitAsync();
    
}

static void LogNotificationHelper(object sender, NpgsqlNotificationEventArgs e)
 {
   ///further code to read notification values..
 }

您可以在 postgres 配置中增加允许的最大连接数

*max_connections (integer)*

Determines the maximum number of concurrent connections to the database server. The default is typically 100 connections, but might be less if your kernel settings will not support it (as determined during initdb). This parameter can only be set at server start.

When running a standby server, you must set this parameter to the same or higher value than on the master server. Otherwise, queries will not be allowed in the standby server.

这里

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM