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 ...
随机推荐
- 获取一个 app 的 URL Scheme 的方法:
获取一个 app 的 URL Scheme 的方法: 上这个网站 URL Schemes 查一下相应的 app 的 URL Scheme 是否有被收录 第一种方法没找到的话,把相应的 app 的 ip ...
- UIkit框架介绍
UIKit Framework The UIKit framework (UIKit.framework) provides crucial infrastructure for implementi ...
- 省赛13 Alice and Bob(二进制,找规律)
题意:多项式相乘,(a0x+1)(a1x^2+1)(a2x^4+1),问x的m次方的系数是多少,当时没做出来,搜的某大神的博客,好理解. 思路:多列几个式子就能明白规律了: (a0x+1)(a1x^2 ...
- 11、C#基础整理(特殊集合和哈希表)
特殊集合:队列.栈 一.栈Stack类:先进后出,没有索引 Stack ss = new Stack(); 1.增加数据:push :将元素推入集合 ss.Push(); ss.Push(); ss. ...
- esayui-datagrid的使用
第一步:在页面上引入easyui的jQuery链接 <script src="../../Scripts/easyUI/jquery-1.7.2.min.js" type=& ...
- [转]Raft [Why Not Paxos]
http://blog.csdn.net/cszhouwei/article/details/38374603 动画讲解 http://thesecretlivesofdata.com/raft/ W ...
- 用rem来做响应式开发
强烈推荐这篇文章:<web app 变革之rem> px转rem工具:<px转rem工具> 由于最近在做公司移动项目的重构,因为要实现响应式的开发,所以大量使用到了rem的单位 ...
- 【转】7 Tips to Speed Up Eclipse
技巧一:运行最新版本的JDK和Eclipse 通常,新版本的JDK和Eclipse都会有性能上的优化.请确保你使用的是64位Eclipse并且使用了Oracle的JDK.对于网络开发,需要使用Ecli ...
- OOP初学小结
最近刚刚开始学python的OOP,感觉不太适应.一些很简单的程序也卡了好半天才能调好- 其中的一个错误是:将两个不同的类的方法互相调用,结果走进死循环- 另外就是debug的时候,不要在那里空空地望 ...
- 最大流 Dinic
struct Dinic { struct node { int x,y,c,next; }line[MAXM]; int Lnum,_next[MAXN],dis[MAXN],dp[MAXN]; b ...