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 ...
随机推荐
- poj1125(Floyd最短路)
//Accepted 164 KB 0 ms //floyd #include <cstdio> #include <cstring> #include <iostrea ...
- jstl表达式替换某些字符
转自:http://www.yiibai.com/jsp/jstl_function_replace.html fn:replace() 函数替换一个字符串与另一个字符串的所有匹配. 语法 fn:re ...
- hdu 2054
Ps:WA了无数次,,简直成了心病..今天终于AC了..先取整数部分,去零,判断位数相等否,再比较.如果相等,再取小数部分,去零,比较,输出....好烦... 代码; #include "s ...
- C++中的数组与指针
数组与指针看起来很像 int a[] = {1, 2 ,3}; int *p = a; 如此,我们可以p[0], p[1], p[2] 看起来,与直接使用数组名没什么两样,但是看这段代码 sizeof ...
- servlet容器处理请求过程
下图是关于tomcat服务器接收客户请求并作出响应的图例. tomcat不仅仅只是一个servlet容器,也是一个web服务器,servlet容器在web服务器之内或者说servlet容器托管于web ...
- 算法----序列和的 top N
Description: 两个长度为 n 的数组 A 和 B, 各从中选出一个元素相加 A[i] + B[j], 求 top n 小的那些和. 思路 1:这样的和总共有 n^2 个, 排序,然后取前 ...
- 制作部署安装包:Inno Setup
制作部署安装包:Inno Setup 前一篇尝试Office 2003 VSTO的开发.部署有提到用VS开发一个简单的VSTO程序.打包C/S程序,我首先想到的是VS里自带的Setup Project ...
- 转:C#精髓 第四讲 GridView 72般绝技
说明:准备出一个系列,所谓精髓讲C#语言要点.这个系列没有先后顺序,不过尽量做到精.可能会不断增删整理,本系列最原始出处是csdn博客,谢谢关注. C#精髓 第四讲 GridView 72般绝技 作者 ...
- Android FM模块学习之二 FM搜索频道
最近在学习FM模块,FM是一个值得学习的模块,可以从上层看到底层.上层就是FM的按扭操作和界面显示,从而调用到FM底层驱动来实现广播收听的功能. 看看FM启动流程:如下图: 先进入FMRadio.ja ...
- LeetCode Spiral Matrix II (技巧)
题意: 从1开始产生连续的n2个数字,以螺旋的方式填满一个n*n的数组. 思路: 由于是填满一个矩阵,那么只需要每次都填一圈即可.应该注意特殊情况. 迭代: class Solution { publ ...