pgbouncer配置
DESCRIPTION
pgbouncer is a PostgreSQL connection pooler. Any target application can be connected to pgbouncer as if it were a PostgreSQL server, and pgbouncer will create a connection to the actual server, or it will reuse one of its existing connections.
The aim of pgbouncer is to lower the performance impact of opening new connections to PostgreSQL.
In order not to compromise transaction semantics for connection pooling, pgbouncer supports several types of pooling when rotating connections:
- Session pooling
-
Most polite method. When client connects, a server connection will be assigned to it for the whole duration the client stays connected. When the client disconnects, the server connection will be put back into the pool. This is the default method.
- Transaction pooling
-
A server connection is assigned to client only during a transaction. When PgBouncer notices that transaction is over, the server connection will be put back into the pool.
- Statement pooling
-
Most aggressive method. The server connection will be put back into pool immediately after a query completes. Multi-statement transactions are disallowed in this mode as they would break.
The administration interface of pgbouncer consists of some new SHOW commands available when connected to a special virtual database pgbouncer.
QUICK-START
Basic setup and usage as following.
Create a pgbouncer.ini file. Details in pgbouncer(5). Simple example:
[databases]
template1 = host=127.0.0.1 port=5432 dbname=template1[pgbouncer]
listen_port = 6543
listen_addr = 127.0.0.1
auth_type = md5
auth_file = users.txt
logfile = pgbouncer.log
pidfile = pgbouncer.pid
admin_users = someuserCreate a users.txt file:
"someuser" "same_password_as_in_server"
Launch pgbouncer:
$ pgbouncer -d pgbouncer.ini
Have your application (or the psql client) connect to pgbouncer instead of directly to PostgreSQL server.
$ psql -p 6543 -U someuser template1
Manage pgbouncer by connecting to the special administration database pgbouncer and issuing show help; to begin:
$ psql -p 6543 -U someuser pgbouncer
pgbouncer=# show help;
NOTICE: Console usage
DETAIL:
SHOW [HELP|CONFIG|DATABASES|FDS|POOLS|CLIENTS|SERVERS|SOCKETS|LISTS|VERSION]
SET key = arg
RELOAD
PAUSE
SUSPEND
RESUME
SHUTDOWNIf you made changes to the pgbouncer.ini file, you can reload it with:
pgbouncer=# RELOAD; 参考:http://pgbouncer.projects.pgfoundry.org/doc/usage.html
pgbouncer配置的更多相关文章
- 使用PgBouncer连接池
1.pgbouncer 的介绍 pgbouncer是一个针对PostgreSQL数据库的轻量级连接池,任何目标应用都可以把 pgbouncer 当作一个 PostgreSQL/Greenplum 服务 ...
- PostgreSQL Replication之第八章 与pgbouncer一起工作(1)
当您在使用大规模的设施工作,可能有时候,您必须处理许多并发打开的连接.没有人会使用十台服务器来为两个并发用户提供服务--在许多情况下,这根本没有意义.大量的设施通常会处理成百上千的并发连接.引入连接池 ...
- [原]OpenStreetMap数据瓦片服务性能篇
上文说到如何利用node-mapnik架设OpenStreetMap瓦片服务,解决了有没有的问题.然而这个服务还是比较孱弱,主要表现在以下几个方面: 1. Node.js只能使用CPU的一个核,不能有 ...
- linux ---pgbouncer的安装和配置
pgbouncer是一款轻量级针对postgresql的数据库连接工具,可以对客户端的连接做限制,防止恶意连接,另外也可以减少数据库的实际连接数,从而减少数据库的开销. 环境: centos 6.5 ...
- pgbouncer的安装和配置
tar -zxvf libevent-2.0.21-stable.tar.gzcd libevent-2.0.21-stable/mkdir /home/pg10/libevent./configur ...
- pgbouncer介绍
一.Pgbouncer 的介绍 Pgbouncer是一个针对PostgreSQL数据库的轻量级连接池,任何目标应用都可以把 pgbouncer 当作一个 PostgreSQL 服务器来连接,然后pgb ...
- pgbouncer+pg(fdw)+pg(datanode)分表方案
pgbouncer+pg(fdw)+pg(datanode)分表方案 (环境RHEL6.5,PG9.4.5,pgbouncer1.5.4,libevent2.0.22) 方案架构图如下: pgboun ...
- [原创]PostgreSQL Plus Advince Server在 HA环境中一对多的Stream Replication配置(一)
内容较多,开篇作为说明和目录. 实验环境规划:服务器:IBM x3500 m3三台其中两台用作HA,另外一台安装VMware ESXi安装两个虚机做Stream Replication.NAS存储IP ...
- postgresql9.5 run 文件linux安装后配置成开机服务
网上出现的比较多安装方法要么是源码安装,要么是yum安装,我发觉都要配置很多属性,比较麻烦,所以现在我在centos7长用 run文件来安装 http://get.enterprisedb.com/p ...
随机推荐
- poj2769 暴力
//Accepted 208 KB 157 ms //纯暴力 //vis数组初始化时要用多少设置多少,不然TLE #include <cstdio> #include <cstrin ...
- 在windows 、linux下读取目录下所有文件名
Windows要引入的头文件是<Windows.h> 主要是两个函数FindFirstFile.FindNextFile MSDN里是这么说的: FindFirstFile functio ...
- 解决办法:在指定的 DSN 中,驱动程序和应用程序之间的体系结构不匹配 问题解决 SQLSTATE=IM014
环境:64位win7,64位MySql 解决办法:32为和64位ODBC都安装上即可.
- UIControl的使用
在开发当中,可能很多时候都需要做个点赞的需求,如果用按钮实现,按钮作为一个系统复合控件,外部是一个 View-->UIControl的容器, 内部包含了UILabel和UIImage,以及一些排 ...
- javaweb-dbcp2
package cn.itcast.utils; import java.io.InputStream;import java.sql.Connection;import java.sql.Drive ...
- Best Practice: Avoiding or minimizing synchronization in servlets
Introduction Minimize the use of synchronization in servlets. Because servlets are multi-threaded, s ...
- iOS开发:集成支付宝(遇见的坑和便捷撸代码)
开发iOS最重要的就是支付了,天朝之内最常用的就是支付宝了,下面就以自己的经历说明如何集成支付宝+遇见的坑. 首先,集成支付宝最好别使用Cocoapods,很多人都说使用起来很方便,可是我每次只要使用 ...
- 第一个Sprint冲刺第九天
讨论成员:邵家文.李新.朱浩龙.陈俊金 工作:修改公式,修改bug
- Samsung_tiny4412(驱动笔记01)----linux 3.5,U-Boot,Busybox,SD卡启动环境搭建
/*********************************************************************************** * * linux 3.5,U ...
- php计算一天的时间
代码如下: $time=time(); //一天的开始 $start=strtotime(date('Y-m-d',$time).'00:00:01'); echo date('Y-m-d H:i:s ...