postgres高可用学习篇二:通过pgbouncer连接池工具来管理postgres连接
安装pgbouncer
yum install libevent -y
yum install libevent-devel -y
wget http://www.pgbouncer.org/downloads/files/1.11.0/pgbouncer-1.11.0.tar.gz
tar -xvf pgbouncer-1.11.0.tar.gz
./configure --prefix=/usr/local --with-libevent=libevent-prefix
make
make install
node1:编辑pgbouncer.ini配置文件
cat /etc/pgbouncer/pgbouncer.ini
[databases]
postgres = host=127.0.0.1 port=5432 dbname=postgres [pgbouncer]
logfile = /var/log/pgbouncer/pgbouncer.log
pidfile = /var/run/pgbouncer/pgbouncer.pid
listen_addr = 192.168.216.130
listen_port = 6432
unix_socket_dir = /var/run/postgresql
auth_type = md5
auth_file = /etc/pgbouncer/userlist.txt
admin_users = postgres
ignore_startup_parameters = extra_float_digits,geqo pool_mode = session
server_reset_query = DISCARD ALL
max_client_conn = 10000
default_pool_size = 10
reserve_pool_size = 1
reserve_pool_timeout = 1
max_db_connections = 1000
pkt_buf = 8192 # Documentation https://pgbouncer.github.io/config.html
配置postgres管理账户和密码
cat /etc/pgbouncer/userlist.txt
"postgres" "postgres-pass"
node2:编辑pgbouncer.ini配置文件
cat /etc/pgbouncer/pgbouncer.ini
[databases]
postgres = host=127.0.0.1 port=5432 dbname=postgres [pgbouncer]
logfile = /var/log/pgbouncer/pgbouncer.log
pidfile = /var/run/pgbouncer/pgbouncer.pid
listen_addr = 192.168.216.132
listen_port = 6432
unix_socket_dir = /var/run/postgresql
auth_type = md5
auth_file = /etc/pgbouncer/userlist.txt
admin_users = postgres
ignore_startup_parameters = extra_float_digits,geqo pool_mode = session
server_reset_query = DISCARD ALL
max_client_conn = 10000
default_pool_size = 10
reserve_pool_size = 1
reserve_pool_timeout = 1
max_db_connections = 1000
pkt_buf = 8192 # Documentation https://pgbouncer.github.io/config.html
配置postgres管理账户和密码
cat /etc/pgbouncer/userlist.txt
"postgres" "postgres-pass"
node3:编辑pgbouncer.ini配置文件
cat /etc/pgbouncer/pgbouncer.ini
[databases]
postgres = host=127.0.0.1 port=5432 dbname=postgres [pgbouncer]
logfile = /var/log/pgbouncer/pgbouncer.log
pidfile = /var/run/pgbouncer/pgbouncer.pid
listen_addr = 192.168.216.134
listen_port = 6432
unix_socket_dir = /var/run/postgresql
auth_type = md5
auth_file = /etc/pgbouncer/userlist.txt
admin_users = postgres
ignore_startup_parameters = extra_float_digits,geqo pool_mode = session
server_reset_query = DISCARD ALL
max_client_conn = 10000
default_pool_size = 10
reserve_pool_size = 1
reserve_pool_timeout = 1
max_db_connections = 1000
pkt_buf = 8192 # Documentation https://pgbouncer.github.io/config.html
配置postgres管理账户和密码
cat /etc/pgbouncer/userlist.txt
"postgres" "postgres-pass"
创建/etc/systemd/system/pgbouncer.service文件,通过systemctl管理pgbouncer服务
cat /etc/systemd/system/pgbouncer.service
[Unit]
Description=pgBouncer connection pooling for PostgreSQL
After=syslog.target network.target [Service]
Type=forking User=postgres
Group=postgres PermissionsStartOnly=true
ExecStartPre=-/bin/mkdir -p /var/run/pgbouncer /var/log/pgbouncer
ExecStartPre=/bin/chown -R postgres:postgres /var/run/pgbouncer /var/log/pgbouncer
ExecStart=/usr/bin/pgbouncer -d /etc/pgbouncer/pgbouncer.ini
ExecReload=/bin/kill -SIGHUP $MAINPID
PIDFile=/var/run/pgbouncer/pgbouncer.pid LimitNOFILE=100000 [Install]
WantedBy=multi-user.target

postgres高可用学习篇二:通过pgbouncer连接池工具来管理postgres连接的更多相关文章
- postgres高可用学习篇一:如何通过patroni如何管理3个postgres节点
环境: CentOS Linux release 7.6.1810 (Core) 内核版本:3.10.0-957.10.1.el7.x86_64 node1:192.168.216.130 node2 ...
- postgres高可用学习篇三:haproxy+keepalived实现postgres负载均衡
环境: CentOS Linux release 7.6.1810 (Core) 内核版本:3.10.0-957.10.1.el7.x86_64 node1:192.168.216.130 node2 ...
- 企业级Nginx负载均衡与keepalived高可用实战(二)keepalived篇
1.Keepalived高可用软件 1.1.Keepalived介绍 Keepalived软件起初是专门为LVS负载均衡软件设计的,用来管理并监控LVS集群系统中各个服务节点的状态,后来又加入了可以实 ...
- zabbix 3.2 高可用实现方式二-pacemaker+corosync实现zabbix高可用集群
一.pacemaker 是什么 1.pacemaker 简单说明 2.pacemaker 由来 二.pacemaker 特点 三.pacemaker 内部结构 1.群集组件说明: 2.功能概述 四.c ...
- 高可用架构篇--MyCat在MySQL主从复制基础上实现读写分离
实战操作可参考:http://www.roncoo.com/course/view/3117ffd4c74b4a51a998f9276740dcfb 一.环境 操作系统:CentOS-6.6-x86_ ...
- 分布式架构高可用架构篇_07_MySQL主从复制的配置(CentOS-6.7+MySQL-5.6)
参考: 龙果学院http://www.roncoo.com/share.html?hamc=hLPG8QsaaWVOl2Z76wpJHp3JBbZZF%2Bywm5vEfPp9LbLkAjAnB%2B ...
- hasura graphql-engine集成pgbouncer 连接池工具
pgbouncer 是一个轻量的pg 连接池工具,我们可以和hasura graphql-engine集成起来,进行连接的一些优化 环境准备 docker-compose 文件 version: '3 ...
- 分布式架构高可用架构篇_01_zookeeper集群的安装、配置、高可用测试
参考: 龙果学院http://www.roncoo.com/share.html?hamc=hLPG8QsaaWVOl2Z76wpJHp3JBbZZF%2Bywm5vEfPp9LbLkAjAnB%2B ...
- 分布式架构高可用架构篇_04_Keepalived+Nginx实现高可用Web负载均衡
参考: 龙果学院http://www.roncoo.com/share.html?hamc=hLPG8QsaaWVOl2Z76wpJHp3JBbZZF%2Bywm5vEfPp9LbLkAjAnB%2B ...
随机推荐
- Referenced file contains errors (http://www.springframework.org/...解决
今天打开老项目出现如下错误: Referenced file contains errors (http://www.springframework.org/schema/context/spring ...
- 袁新生《LINGO和Excel在数学建模中的应用》
内容介绍 本书深入浅出地介绍了LINGO的基础知识.用LINGO语言描述现实问题的方法和用Excel处理数据的方法,重点是这两种软件在解决各种优化问题以及在数学建模中的应用,通过丰富的实例介绍了把实际 ...
- 031 SSM综合练习07--数据后台管理系统--用户详情查询
1.用户详情查询流程分析 2.代码实现 (1)user-list.jsp页面部分代码 点击jsp页面中的详情按钮,发送请求到UserController.java <!--数据列表--> ...
- 我瞅瞅源码系列之---drf
我瞅瞅源码系列之---drf restful规范 从cbv到drf的视图 / 快速了解drf 视图 版本 认证 权限 节流 jwt 持续更新中...
- 2019-7-16 import / from...import... 模块的调用
模块调用的总结:如果你是pycharm打开文件,会自动帮你把文件根目录加到system.path中,你要调用模块直接以根目录为基准开始找.1.假如你要调用和文件根目录为同级的文件,你直接import ...
- 4. Spark Streaming解析
4.1 初始化StreamingContext import org.apache.spark._ import org.apache.spark.streaming._ val conf = new ...
- 【简解】C2CRNI - Crni
[题目大意] 给定一个N行N列的矩阵,每个格子要么为白色要么为黑色.黑矩形为所涵单元格数大于等于2且所涵单元格均为黑色的矩表.要解决的问题是在给定的矩形中找出两个没有共公部分的黑矩形,输出所有方案数, ...
- WPF 使用 AppBar 将窗口停靠在桌面上,让其他程序不占用此窗口的空间(附我封装的附加属性)
原文:WPF 使用 AppBar 将窗口停靠在桌面上,让其他程序不占用此窗口的空间(附我封装的附加属性) 本文介绍如何使用 Windows 的 AppBar 相关 API 实现固定停靠在桌面上的特殊窗 ...
- Ambari深入学习(II)-实现细节
在第一节中,我们简单讲了一下Ambari的系统架构.我们这一节主要分析Ambari的源代码,总览Ambari的具体实现方式及其工作细节. 一.Ambari-Server启动 Ambari-Server ...
- 使用Powershell启用/关闭Windows功能
接上一篇博客,依旧是需要制作安装包,需要开启系统的MSMQ功能.这里就用到了dism.exe DISM全称是Deployment Image Servicing and Management(部署映像 ...