Re: Limits user connection in pgbouncer

From: Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: Limits user connection in pgbouncer
Date: 2021-12-13 08:42:39
Message-ID: 3f48f38a-c3f5-205b-1d4f-6e561417272e@matrix.gatewaynet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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

--
Achilleas Mantzios
DBA, Analyst, IT Lead
IT DEPT
Dynacom Tankers Mgmt

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Joao COSTA 2021-12-13 10:19:46 PostgreSQL - CVE-2021-44228 - dependency on Log4j ?
Previous Message Daulat 2021-12-13 08:05:30 Limits user connection in pgbouncer