Re: [EXTERNAL] Re: Limits user connection in pgbouncer
От | Achilleas Mantzios |
---|---|
Тема | Re: [EXTERNAL] Re: Limits user connection in pgbouncer |
Дата | |
Msg-id | 32e9b37c-ba06-67df-9b09-4d7fc865e528@matrix.gatewaynet.com обсуждение исходный текст |
Ответ на | Re: [EXTERNAL] Re: Limits user connection in pgbouncer (Daulat <daulat.dba@gmail.com>) |
Список | pgsql-admin |
On 15/12/21 1:56 μ.μ., Daulat wrote:
Read this : http://www.pgbouncer.org/config.htmlThanks !
max_connections =100 in postgresql.conf
I am attaching my .ini file , help where I need to change .
max_db_connections is a generic not a db-specific setting, so adjust your ini file accordingly.
The Goal is to limit the number of connections from a specific app - when the db name is db1 and user is user1, only 55 connections are allowed (max_db_connections).On Wed, Dec 15, 2021 at 2:58 PM Achilleas Mantzios <achill@matrix.gatewaynet.com> wrote:On 14/12/21 6:25 μ.μ., Daulat wrote:The point with pgbouncer is to map N user connections to n DB connections where N >> n. So pgbouncer will allow up to max_client_conn in total, but every user (user1) will have max 2 real DB connections to this pgbouncer db (db1).still i am able to login more than 2 connections after making changes under the database section .[databases]
db1 = host=localhost port=5432 dbname=db1 pool_mode = transaction pool_size=2 max_db_connections=2 user=user1Thanks
Makes sense?Do it under the databases sectionSent from my iPadOn Dec 14, 2021, at 2:28 AM, Daulat <daulat.dba@gmail.com> wrote: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=2Here are my other details:[databases]
db1 = host=localhost dbname=db1logfile = /var/log/pgbouncer/pgbouncer.log
pidfile = /var/run/pgbouncer/pgbouncer.pidlisten_addr = *
listen_port = 6432auth_type = md5
auth_file = /etc/pgbouncer/userlist.txt
admin_users = postgrespool_mode = sessionmax_client_conn = 300max_db_connections = 2max_user_connections = 2On Mon, Dec 13, 2021 at 6:38 PM MichaelDBA <MichaelDBA@sqlexec.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,Just specify this in the db definition configuration :
How can we limit the user to make a specific number of connections to the database?
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.-- Achilleas Mantzios DBA, Analyst, IT Lead IT DEPT Dynacom Tankers Mgmt
-- Achilleas Mantzios DBA, Analyst, IT Lead IT DEPT Dynacom Tankers Mgmt
В списке pgsql-admin по дате отправления: