RE: [EXTERNAL] Re: Limits user connection in pgbouncer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




-----Original Message-----
From: Achilleas Mantzios <achill@xxxxxxxxxxxxxxxxxxxxx> 
Sent: Monday, December 13, 2021 2:43 AM
To: pgsql-admin@xxxxxxxxxxxxxxxxxxxx
Subject: [EXTERNAL] Re: Limits user connection in pgbouncer

On 13/12/21 10:05 π.μ., Daulat wrote:
> Hello Team,
> How can we limit the user to  make a specific number of connections to the database?
Just specify this in the db definition configuration :

db1 = host=localhost dbname=db1 pool_size=2

but it will apply to every user, so that every user's pool will have max 2 connections, not only user1.

Alternatively you could set "ALTER ROLE .. CONNECTION LIMIT connlimit " for user1 individually.

>
> Suppose, I have a user "user1" and I want to limit it to make only 2 connections. I have tried but not done.
>
> Here are my pgbouncer.ini options.
>
> db1 = host=localhost dbname=db1
> logfile = /var/log/pgbouncer/pgbouncer.log pidfile = 
> /var/run/pgbouncer/pgbouncer.pid listen_addr = * listen_port = 6432 
> auth_type = md5 auth_file = /etc/pgbouncer/userlist.txt admin_users = 
> postgres pool_mode = session max_client_conn = 300 max_db_connections 
> = 2 max_user_connections = 2
>
> Thanks


Take a peek in the delivers pgbouncer.ini file:

;; User-specific configuration
[users]
#postgres=pool_mode=sessio
my_useracct=pool_mode=session max_user_connections=6
your_useracct = pool_mode=transaction max_user_connections=2






[Index of Archives]     [Postgresql Home]     [Postgresql General]     [Postgresql Performance]     [Postgresql PHP]     [Postgresql Jobs]     [PHP Users]     [PHP Databases]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Forum]

  Powered by Linux