Version 12 (modified by jpo, 8 years ago)

--

PgBouncer

  1. Instalacja (Debian)
apt-get install pgbouncer
  1. Konfiguracja

cp /etc/pgbouncer/pgbouncer.ini /etc/pgbouncer/pgbouncer.ini.orig vim /etc/pgbouncer/pgbouncer.ini # wyczyścić wszystko i wkleić poniższą zawartość

[databases]

* =

[pgbouncer]
logfile = /var/log/postgresql/pgbouncer.log
pidfile = /var/run/postgresql/pgbouncer.pid
listen_addr = 127.0.0.1
listen_port = 6432
unix_socket_dir = /var/run/postgresql
auth_type = trust
auth_file = /etc/pgbouncer/userlist.txt
admin_users = postgres
stats_users = postgres
pool_mode = transaction

log_connections = 0
log_disconnections = 0
stats_period = 300

vim /etc/pgbouncer/userlist.txt

"postgres" ""
"edokumenty" ""
"http" ""

vim /etc/default/pgbouncer

START=1
  1. Restart usługi
/etc/init.d/pgbouncer restart
  1. Konfiguracja eDokumenty (config.inc)

W stałej "DB_NAME" zmieniamy/ustawiamy port na podany w "listen_port" (z konfiguracji pgbouncer.. dmyślnie: 6432). np.

define('DB_NAME', 'dbname=edokumenty port=6432 user=http');

==Znane problemy== W przypadku gdy mamy problemy z połączeniem na porcie 6432 należy sprawdzić logi pgbouncera. Najczęstszym problem jest brak dostępu do folderu /var/run/postgresql