Step One: Install PG basic software
NOTE: Before installing PG, it is recommended to create a Postgres account and then use this account to install the PG software.
1:./configure–prefix= ... (Point to the directory you want to install)
2:make & sudo make
3: Create PG Data Storage directory
mkdir ~/data
4: Initializing PG
Initdb ~/data
Step Two: Installing the PG Connection Pool Pgbouncer
Libraries required to install the Libevent&c-areq,pgbouncer
1: Install Libevent
wget https://github.com/downloads/libevent/libevent/libevent-2.0.22-stable
TAR-ZXVF libevent-2.0.22-stable.tar.gz
CD libevent-2.0.22-stable
./configure && make && make install
All used dynamic library into the system cache
echo "/usr/local/lib" >>/etc/ld.so.conf
Ldconfig
2: Install C-areq
wget http://c-ares.haxx.se/download/c-ares-1.10.0.tar.gz
TAR-ZXVF c-ares-1.10.0.tar.gz
CD c-ares-1.10.0
./configure && make && make install
Ldconfig
3: Install Pgbouncer
git clone git://git.postgresql.org/git/pgbouncer.git
CD Pgbouncer
Git submodule init
git submodule update
./autogen.sh
./configure--prefix=/home/postgres/pgbouncer--with-libevent=/usr/local/lib--with-cares=/usr/local/lib
Make && make install
Configure Pgbouncer
Mkdir-p ~/pgbouncer/etc
Vim Config.ini
[databases]TestDB= host=127.0.0.1 port=5432 pool_size=50 dbname=TestDB[Pgbouncer]Pool_mode=Transactionlisten_port= 6543listen_addr= 0.0.0.0Auth_type=Md5auth_file=/home/postgres/pgbouncer/etc/users.txtlogfile=/home/postgres/pgbouncer/log/pgbouncer.logpidfile=/home/postgres/pgbouncer/pgbouncer.pidunix_socket_dir=/home/postgres/pgbouncer/etcadmin_users=pgadminstats_users=Pgstatserver_reset_query=DISCARD allserver_check_query= Select 1Server_check_delay= 30Max_client_conn= 50000default_pool_size= 20reserve_pool_size= 5Dns_max_ttl= 15ignore_startup_parameters= Extra_float_digits
Vim Users.txt
Postgres User Password is Postgres
"Postgres" "md53175bce1d3201d16594cebf9d7eb3f9d" "Pgadmin" " pgadmin" "Pgstat" " Md510a90e7529bc649302c9bfabefd51b93 "
Step three: Install local tell cache Pgfincore (please download it by yourself)
After downloading the file, unzip it.
Make&&make Install can
At this point, the PG Service installation is complete, and there is a pretty good performance Oh!
PostgreSQL installation Log