pgbouncer centos7.4 install
admin
2023-05-21 08:22:39
0

编辑器原因 ‘-#’符号需要去掉‘-’

-# 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
-# ls
bin 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.log
pidfile = /opt/pgbouncer/1.8.1/run/pgbouncer.pid
listen_addr = 0.0.0.0
unix_socket_dir = /opt/pgbouncer/1.8.1/tmp
auth_type = md5
auth_file = /opt/pgbouncer/1.8.1/etc/userlist.txt
admin_users = pgbadmin
pool_mode = transaction
server_reset_query = RESET ALL
server_reset_query_always = 1
ignore_startup_parameters = extra_float_digits
max_client_conn = 1000
default_pool_size = 2
min_pool_size = 1
reserve_pool_size = 1
pkt_buf = 8192
listen_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
{
missingok
nocompress
notifempty
sharedscripts
create 0640 postgres postgres
daily
rotate 10
postrotate
/bin/kill -HUP cat /opt/pgbouncer/1.8.1/run/pgbouncer.pid 2>/dev/null 2> /dev/null || true
endscript
}
-#

启动脚本

-# 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
-# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F

[Unit]
Description=A lightweight connection pooler for PostgreSQL
After=syslog.target
After=network.target

[Service]
Type=forking

User=postgres
Group=postgres

-# Path to the init file
Environment=BOUNCERCONF=/opt/pgbouncer/1.8.1/etc/pgbouncer.ini

PIDFile=/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=syslog

ExecStart=/opt/pgbouncer/1.8.1/bin/pgbouncer -d -q ${BOUNCERCONF}
ExecReload=/usr/bin/kill -HUP $MAINPID
KillSignal=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

相关内容

热门资讯

小米澎程72小时一线预售快报出... 来源:CNMO科技 【CNMO科技消息】8月3日,CNMO科技注意到,车fans创始人@孙少军发布了...
海评面:“中国商业航天正以惊人... 7月22日,引力一号遥四运载火箭在上海东部海域点火升空。(图/新华社) “中国商业航天领域正以惊人的...
第三届雷达学术前沿大会在长沙举... 中新网长沙8月2日电(王曼)8月2日,第三届雷达学术前沿大会在长沙启幕,雷达及相关领域8位院士,12...
埃及、卡塔尔和土耳其发表联合声... △加沙地带(资料图)当地时间3日,埃及、卡塔尔和土耳其三国发表联合声明,强烈谴责以色列在加沙地带持续...
鹤壁市汽车电子电气行业技术宣讲... 为助推我市汽车电子电器产业智能化、数字化和绿色化转型升级。7月30日,由市工商联、市汽车电子电器商会...
原创 i... 新一代系统陆续推出,多方面进行升级,尤其是UI设计、AI智能体、流畅度等方面,助力新一代旗舰机全面发...
国产最强AI再次选择开源!阿里... IT之家 8 月 3 日消息,阿里巴巴千问 Qwen3.8-Max 人工智能模型今日(8 月 3 日...
特朗普:在伊朗战争期间,石油公... 美国有线电视新闻网(CNN)8月3日报道,特朗普周一表示,由于与伊朗战争相关的油价飙升,雪佛龙和埃克...
特朗普:与伊朗的谈判将分两阶段... △当地时间8月3日,美国总统特朗普在白宫回答记者提问。当地时间8月3日,美国总统特朗普在白宫回答记者...
汇艺银河里首届微醺节圆满收官 ... 多元业态协同联动,探索郑东商圈夜间消费新场景首届汇艺银河里微醺节圆满收官。活动立足郑州高铁东站商圈核...