Question

On Ubuntu 12.04 (precise) in a Windows Azure VM I have postgres and pgbouncer running on the same machine. Everything is setup and works however when the VM is rebooted pgbouncer doesn't automatically startup.

  1. How do I make it so that it starts on reboot?
  2. Does Postgres need to be running before PGBouncer? If so how is this accomplished? I'm assuming PGBouncer would still run just any sql connections wouldn't connect if Postgres wasn't running or is this assumption wrong?

The commands I run to get it started are the below. Note: I need to be 'postgres' user in order to start the service otherwise it fails. Also detailed answer preferrend. Linux isn't my normal OS.

sudo su postgres
pgbouncer -d -v /etc/pgbouncer/pgbouncer.ini

If helpful, this is how pgbouncer was installed:

sudo apt-get install postgresql-9.3 pgbouncer

Note: I can interact with pgbouncer service (force-reload, status, start, stop) however only after I first run the pgbouncer -d -v /etc/pgbouncer/pgbouncer.ini command.

Was it helpful?

Solution

Edit /etc/default/pgbouncer and set

START=1

Then start pgbouncer using the init script:

/etc/init.d/pgbouncer start

The init script will automatically start pgbouncer on boot. But you need to make that START=1 setting.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top