Difference between revisions of "Pgbouncer"

From UVOO Tech Wiki
Jump to navigation Jump to search
(Created page with "# Install ``` apt install pgbouncer ``` ``` create role someuser; create role someadmin; ALTER ROLE someadmin WITH PASSWORD 'test'; ALTER ROLE someuser WITH PASSWORD 'test';...")
 
Line 16: Line 16:
 
```
 
```
 
sudo -u postgres psql -Atq -U postgres -d postgres -c "SELECT concat('\"', usename, '\" \"', passwd, '\"') FROM pg_shadow" > /etc/pgbouncer/userlist.txt
 
sudo -u postgres psql -Atq -U postgres -d postgres -c "SELECT concat('\"', usename, '\" \"', passwd, '\"') FROM pg_shadow" > /etc/pgbouncer/userlist.txt
 +
```
 +
 +
/etc/pgbouncer/pgbouncer.ini
 +
```
 +
[databases]
 +
 +
# pgb = dbname=pgb host=127.0.0.1 port=5432
 +
template1 = dbname=template1 host=127.0.0.1 port=5432
 +
auth_type = any # any, trust, plain, md5, cert, hba, pam
 
```
 
```
  

Revision as of 00:53, 17 January 2021

Install

apt install pgbouncer
create role someuser;
create role someadmin;
ALTER ROLE someadmin WITH PASSWORD 'test';
ALTER ROLE someuser WITH PASSWORD 'test';
ALTER ROLE someuser WITH login;
ALTER ROLE someadmin WITH login SUPERUSER;

Update userlist.txt

sudo -u postgres psql -Atq -U postgres -d postgres -c "SELECT concat('\"', usename, '\" \"', passwd, '\"') FROM pg_shadow" > /etc/pgbouncer/userlist.txt

/etc/pgbouncer/pgbouncer.ini

[databases]

# pgb = dbname=pgb host=127.0.0.1 port=5432
template1 = dbname=template1 host=127.0.0.1 port=5432
auth_type = any # any, trust, plain, md5, cert, hba, pam

Reestart

service restart pgbouncer