Last active
March 13, 2025 09:51
-
-
Save coder4web/fd2cf270715ab9c69432e8515e70f527 to your computer and use it in GitHub Desktop.
CentOS 8 PgBouncer setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.pgbouncer.org/install.html | |
# sudo dnf install pgbouncer | |
# Problem: package pgbouncer requires python-psycopg2, but none of the providers can be installed | |
# https://www.pgbouncer.org/install.html#building | |
sudo dnf install libevent libevent-devel | |
# https://www.pgbouncer.org/downloads/ | |
wget -c https://www.pgbouncer.org/downloads/files/1.12.0/pgbouncer-1.12.0.tar.gz | |
tar xvfz pgbouncer-1.12.0.tar.gz | |
cd pgbouncer-1.12.0 | |
./configure --prefix=/usr/local | |
make | |
make install | |
: 'LOG | |
INSTALL pgbouncer /usr/local/bin | |
INSTALL README.md /usr/local/share/doc/pgbouncer | |
INSTALL NEWS.md /usr/local/share/doc/pgbouncer | |
INSTALL etc/pgbouncer.ini /usr/local/share/doc/pgbouncer | |
INSTALL etc/userlist.txt /usr/local/share/doc/pgbouncer | |
INSTALL doc/pgbouncer.1 /usr/local/share/man/man1 | |
INSTALL doc/pgbouncer.5 /usr/local/share/man/man5 | |
' | |
ln -s /usr/local/bin/pgbouncer /usr/bin/pgbouncer | |
pgbouncer --version | |
# PgBouncer 1.12.0 | |
mkdir -p /etc/pgbouncer | |
cp /usr/local/share/doc/pgbouncer/pgbouncer.ini /etc/pgbouncer/ | |
cp /usr/local/share/doc/pgbouncer/userlist.txt /etc/pgbouncer/ | |
# PgBouncer should not run as root | |
groupadd pgbouncer | |
useradd --system --no-create-home -g pgbouncer pgbouncer | |
id pgbouncer | |
mkdir -p /var/log/pgbouncer | |
chown pgbouncer:pgbouncer -R /var/log/pgbouncer | |
mkdir -p /var/run/pgbouncer/ | |
chown pgbouncer:pgbouncer -R /var/run/pgbouncer | |
# test: sudo -u pgbouncer pgbouncer /etc/pgbouncer/pgbouncer.ini | |
sudo -u pgbouncer pgbouncer -d /etc/pgbouncer/pgbouncer.ini |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment