最新版postgresql+pgboucer安装

安装postgresql:

wget https://pgbouncer.github.io/downloads/files/1.7.2/pgbouncer-1.7.2.tar.gz
wget http://get.enterprisedb.com/postgresql/postgresql-9.5.1-1-linux-x64.run
wget https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz

tar zxvf libevent-2.0.22-stable.tar.gz
cd libevent-2.0.22-stable
./configure --prefix=/alidata/local/libevent
make
make install
cd ..

tar zxvf pgbouncer-1.7.2.tar.gz
cd pgbouncer-1.7.2
./configure --prefix=/alidata/local/pgbouncer/ --with-libevent=/alidata/local/libevent/
make 
make install
cd ..

chmod 777 postgresql-9.5.1-1-linux-x64.run
./postgresql-9.5.1-1-linux-x64.run

sudo chown -R postgres.postgres /alidata/pgsql
sudo chown -R postgres.postgres /alidata/local/pgbouncer
su - postgres
cp .bash_profile /alidata/pgsql
cp .bashrc  /alidata/pgsql
su - postgres

export PGHOME=/alidata/pgsql
export PATH=$PGHOME/bin:$PATH
export PGDATA=$PGHOME/data
export LD_LIBRARY_PATH=$PGHOME/lib
export LD_LIBRARY_PATH=/usr/local/libevent/lib:$LD_LIBRARY_PATH

[ -z "`cat /alidata/pgsql/data/pg_hba.conf | grep 'fs.file-max'`" ] && cat >> /alidata/pgsql/data/pg_hba.conf << EOF
host  all   all   192.170.206.0/24   md5
EOF

su postgres
./pg_ctl -D /alidata/pgsql/data/ reload

#chkconfig --list postgresql-9.0  
#chkconfig --list postgresql-9.0  
#netstat -ano | grep 5432 

#echo "SU_WHEEL_ONLY yes" >> /etc/login.defs
#more /opt/PostgreSQL/9.0/data/pg_log/startup.log 
#rm -rf /alidata/pgsql
#rm -rf postgres-reg.ini 

#检查服务状态:

service --status-all
service --status-all | grep ntpd
service --status-all | less
service httpd status

#列出所有服务启动级别:
chkconfig --list
#列出服务和他们对应的端口:
netstat -tulpn

chkconfig –list 
#查看服务命令

#chkconfig --add postgresql
#vim /alidata/pgsql/9.5/data/postgresql.conf       (监听更改为*)

#listen_addresses = '*'
#/usr/local/pgbouncer/bin/pgbouncer -d /usr/local/pgbouncer/conf/pgbouncer.ini
#/alidata/local/pgbouncer/bin/pgbouncer -d /alidata/local/pgbouncer/conf/pgbouncer.ini

安装pgbouncer

下载地址:http://pgfoundry.org/frs/download.php/2987/pgbouncer-1.4.1.tgz

安装

tar -zxvf pgbouncer-1.7.2.tgz

cd pgbouncer-1.7.2

./configure --prefix=/usr/local/pg_bouncer

make

make install

su -postgres

/alidata/local/pgbouncer/bin/pgbouncer -d /alidata/local/pgbouncer/conf/pgbouncer.ini

原文地址:https://www.cnblogs.com/fangyuan303687320/p/5633097.html