pgbouncer的安装和配置


tar -zxvf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable/
mkdir /home/pg10/libevent
./configure --prefix=/home/pg10/libevent
make & make install


tar -zxvf pgbouncer-1.7.2.tar.gz
cd pgbouncer-1.7.2
./configure --prefix=/home/pg10/pgbouncer/ --with-libevent=/home/pg10/libevent
make & make install

mkdir /var/log/pgbouncer
mkdir /var/run/pgbouncer
mkdir /etc/pgbouncer

cp /opt/soft_bak/pgbouncer-1.8.1/etc/pgbouncer.ini /etc/pgbouncer

cd /etc/pgbouncer
vi pgbouncer.ini
[databases]
postgres=host=10.110.13.172 port=5432 user=postgres dbname=postgres pool_size=100
[pgbouncer]
logfile = /var/log/pgbouncer/pgbouncer.log
pidfile = /var/run/pgbouncer/pgbouncer.pid
auth_file = /etc/pgbouncer/userlist.txt
auth_type = trust
listen_addr = 10.110.13.172
listen_port = 9999
pool_mode = transaction
admin_users = postgres

vi /etc/pgbouncer/userlist.txt
"postgres" "hytera1993"


chown -R pg10:pg10 /var/log/pgbouncer
chown -R pg10:pg10 /var/run/pgbouncer
chown -R pg10:pg10 /etc/pgbouncer

chmod 755 /var/log/pgbouncer
chmod 755 /var/run/pgbouncer
chmod 755 /etc/pgbouncer

su - pg10
vi .bash_profile
export PATH=/home/pg10/pgbouncer/bin:$PATH:.
source .bash_profile

pgbouncer -d /etc/pgbouncer/pgbouncer.ini --r

1、lsof -i:端口号
2、netstat -tunlp|grep 端口号
都可以查看指定端口被哪个进程占用的情况

猜你喜欢

转载自www.cnblogs.com/dbalightyear/p/11234173.html