3

I installed pgbouncer and configured it and it starts only via using this command

pgbouncer /etc/pgbouncer/pgbouncer.ini

however using service pgbouncer start it dose not start. I then set up supervior with this settings to mannage it which works fine.

[program:pgbouncer]
command=pgbouncer /etc/pgbouncer/pgbouncer.ini
stdout_logfile=/var/log/supervisor/pg_bouncer.log
stderr_logfile=/var/log/supervisor/pg_bouncer_error.log
autostart=true
stopsignal=QUIT
redirect_stderr=true
directory=/etc/pgbouncer/
user=postgres
group=postgres
preload_app = True

when i reboot the system pgbouncer dose not work,looking into the pgbouncer log here is what the error says

WARNING Cannot listen on ::/6432: bind(): Address already in use
WARNING Cannot listen on unix:/var/run/postgresql/.s.PGSQL.6432: bind(): No such file or directory
FATAL @src/main.c:553 in function write_pidfile(): /var/run/pgbouncer/pgbouncer.pid: No such file

and looking into supervisor log this is what it says

LOG File descriptor limit: 1024 (H:4096), max_client_conn: 100, max fds possible: 130
LOG listening on 0.0.0.0:6432
WARNING Cannot listen on ::/6432: bind(): Address already in use
WARNING Cannot listen on unix:/var/run/postgresql/.s.PGSQL.6432: bind(): No such file or directory
FATAL @src/main.c:553 in function write_pidfile(): /var/run/pgbouncer/pgbouncer.pid: No such file or directory

can any one help out with this please

1
3

It turns out that I was putting my pidfile in /var/run which is fine for running it but when server is rebooted the file is deleted and pgbouncer can't find the file and it gives the this error

FATAL @src/main.c:553 in function write_pidfile(): /var/run/pgbouncer/pgbouncer.pid: No such file or directory

So simply moving the file to another location and chown the directory was all that was needed

$ sudo mkdir ~/pgbouncer
$ sudo chown -R postgres:postgres ~/pgbouncer
0

If your port is taken you can always check what's occupying your port

sudo lsof -i -P -n | grep 6432

In my case I had pboucner already running, found this with

pgrep pbouncer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.