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

相关内容

热门资讯

出走10年的妻子“回心转意”?... 近日,张家川县公安局恭门派出所辖区居民丁某前往派出所报案,称可能遭遇电信诈骗。经民警初步了解得知,受...
江苏税务局再回应偷拍女生裙底男... 大皖新闻讯 “研究生校内偷拍女生裙底”事件仍在发酵中。5月18日,国家税务总局江苏省税务局负责招录工...
不妨多给大学开放一些适应时间 澎湃特约评论员 胡栖安5月16日,武汉大学校园开放后的首个周末,不少游客前来参观。视觉中国 图刚刚过...
“娜塔莎”娃娃爆火 被批暴力擦... “娜塔莎”娃娃爆火 被批暴力擦边  【“娜塔莎”娃娃爆火 被批暴力擦边】一款名叫“娜塔莎”的解压玩具...
黄三、李四是谁?多部门回应拆迁... 澎湃新闻记者 陈绪厚拆迁公告中产权人的姓名为“黄三”、“李四”,广州市荔湾区政府国有土地上房屋征收办...
专注大模型的定制软件开发公司解... 专注大模型,定制开发如何避坑?这家公司提供了不一样的思路 当AI的浪潮席卷而来,几乎每一家企业都在思...
外交部回应特朗普涉台表态 新华社北京5月18日电(记者冯歆然、董雪)就美国总统特朗普涉台表态,外交部发言人郭嘉昆18日在例行记...
特朗普访华后高市早苗与其通话,... 澎湃新闻记者 杨文钦 朱郑勇5月18日,外交部发言人郭嘉昆主持例行记者会。迪拜中阿卫视记者提问,在特...
谷歌前CEO毕业典礼谈AI惹争... 来源:环球网 【环球网科技综合报道】5月18日消息,据据 NBC News 报道,前谷歌CEO埃里...
【图片故事】从“打工妹”到隐形... 来源:滚动播报 (来源:工人日报) 近日,在广东鼎泰高科技术股份有限公司总部实验室,王馨(右二)与研...