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

From: Daulat <daulat(dot)dba(at)gmail(dot)com>
To: MichaelDBA <MichaelDBA(at)sqlexec(dot)com>
Cc: "Godfrin, Philippe E" <Philippe(dot)Godfrin(at)nov(dot)com>, Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>, "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: [EXTERNAL] Re: Limits user connection in pgbouncer
Date: 2021-12-14 07:27:37
Message-ID: CALfOM6JUgfknBvP7q1uB=bSzFA0ARWWBRhSTvsk_yw+tnzKykg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi Michael ,

I have tried by setting the below entry under the users section but still I
am able to make more than 2 connections. Please suggest what I am missing
here ?

[users]
user1 = pool_mode=transaction max_user_connections=2

Here are my other details:

[databases]
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

On Mon, Dec 13, 2021 at 6:38 PM MichaelDBA <MichaelDBA(at)sqlexec(dot)com> wrote:

> Hi all,
>
> If you add the user to the database specification, then you can limit
> connections per user:
> db1 = host=localhost dbname=db1 pool_size=2 user=myuser
>
> Regards,
> Michael Vitale
>
>
> Godfrin, Philippe E wrote on 12/13/2021 7:57 AM:
>
> 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.
>
>
>

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Dan Smith 2021-12-14 12:34:29 Re: Default MacOS Username Database
Previous Message dave 2021-12-13 14:09:27 RE: PostgreSQL - CVE-2021-44228 - dependency on Log4j ?