本文共 2722 字,大约阅读时间需要 9 分钟。
编辑器原因 ‘-#’符号需要去掉‘-’
-# yum install -y deltarpm
-# yum install -y openssl-devel zlib-devel readlinie-devel gcc-c++ libevent-devel-# ./configure --prefix=/opt/pgbouncer/1.8.1-# make-# make install-# cd /opt/pgbouncer/1.8.1/
-# mkdir log etc run tmp-# lsbin etc log run share tmp-#-# cp share/doc/pgbouncer/pgbouncer.ini etc/-# cp share/doc/pgbouncer/userlist.txt etc/-#-# vi /opt/pgbouncer/1.8.1/etc/pgbouncer.ini
-#### modify ####[databases]-#### total_pool_size = pool_size + reserve_pool_size ####testdb = port=5432 dbname=testdb pool_size=2 user=testuser password=testuser[pgbouncer]
logfile = /opt/pgbouncer/1.8.1/log/pgbouncer.logpidfile = /opt/pgbouncer/1.8.1/run/pgbouncer.pidlisten_addr = 0.0.0.0unix_socket_dir = /opt/pgbouncer/1.8.1/tmpauth_type = md5auth_file = /opt/pgbouncer/1.8.1/etc/userlist.txtadmin_users = pgbadminpool_mode = transactionserver_reset_query = RESET ALLserver_reset_query_always = 1ignore_startup_parameters = extra_float_digitsmax_client_conn = 1000default_pool_size = 2min_pool_size = 1reserve_pool_size = 1pkt_buf = 8192listen_backlog = 65535-# vi /opt/pgbouncer/1.8.1/etc/userlist.txt
"pgbadmin" "pgbouncer"
"user01" "user01"日志配置
-# vi pgbouncer
/opt/pgbouncer/1.8.1/log/pgbouncer.log { missingoknocompressnotifemptysharedscriptscreate 0640 postgres postgresdailyrotate 10postrotate/bin/kill -HUPcat /opt/pgbouncer/1.8.1/run/pgbouncer.pid 2>/dev/null
2> /dev/null || trueendscript}-# 启动脚本
-# vi /usr/lib/systemd/system/pgbouncer.service
-##### file content start ####-# It's not recommended to modify this file in-place, because it will be-# overwritten during package upgrades. If you want to customize, the-# best way is to create a file "/etc/systemd/system/pgbouncer.service",-# containing-# .include /lib/systemd/system/pgbouncer.service-# ...make your changes here...-# For more info about custom unit files, see-#[Unit]
Description=A lightweight connection pooler for PostgreSQLAfter=syslog.targetAfter=network.target[Service]
Type=forkingUser=postgres
Group=postgres-# Path to the init file
Environment=BOUNCERCONF=/opt/pgbouncer/1.8.1/etc/pgbouncer.iniPIDFile=/opt/pgbouncer/1.8.1/run/pgbouncer.pid
-# Where to send early-startup messages from the server
-# This is normally controlled by the global default set by systemd-# StandardOutput=syslogExecStart=/opt/pgbouncer/1.8.1/bin/pgbouncer -d -q ${BOUNCERCONF}
ExecReload=/usr/bin/kill -HUP $MAINPIDKillSignal=SIGINT-# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300[Install]
WantedBy=multi-user.target-##### content end ####-# chmod +x /usr/lib/systemd/system/pgbouncer.service
转载于:https://blog.51cto.com/heyiyi/2118290