文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

pgbouncer centos7.4 install

2024-04-02 19:55

关注

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

-# 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

阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     813人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     354人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     318人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     435人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     224人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-数据库
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯