標籤:
第一步:安裝pg基本軟體
註:在安裝pg之前,建議先建立好postgres賬戶,然後用此賬戶安裝pg軟體
1: ./configure –prefix=…(指向你想安裝的目錄)
2:make & sudo make
3:建立pg資料存貯目錄
mkdir ~/data
4:初始化pg
initdb ~/data
第二步:安裝pg串連池pgbouncer
安裝libevent&c-areq,pgbouncer所需要的庫
1:安裝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
//所有用的動態庫進系統緩衝
echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig
2:安裝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:安裝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
配置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使用者密碼為postgres
"postgres" "md53175bce1d3201d16594cebf9d7eb3f9d""pgadmin" "pgadmin""pgstat" "md510a90e7529bc649302c9bfabefd51b93"
第三步:安裝本地告訴緩衝pgfincore(請自行去網上下載)
下載好檔案後,解壓
make&&make install 即可
至此,pg服務安裝完成,而且還有一個相當好的效能哦!
PostgreSQL安裝日誌