设为首页 加入收藏

TOP

Linux 平台安装PgBouncer说明文档
2014-11-24 01:45:43 来源: 作者: 【 】 浏览:2
Tags:Linux 平台 安装 PgBouncer 说明 文档

1.安装libevent



下载网址:http://libevent.org/
libevent 1.4.14b-stable
# ./configure
# make
# make install



vi /etc/profile



export LD_LIBRARY_PATH=/usr/local/pgsql/lib:/usr/local/lib



2.安装pgbouncer



1)安装配置pgbouncer



下载网址:http://pgfoundry.org/projects/pgbouncer/
pgbouncer-1.5.4.tar.gz
# ./configure
# make
# make install



复制配置文件
[postgres@gclient pgbouncer-1.5.4]$ pwd
/home/soft/pgbouncer-1.5.4
[postgres@gclient pgbouncer-1.5.4]$ cp etc/pgbouncer.ini /etc/



修改配置文件
[databases]
# 建立数据库连接字符串pgconn
pgconn=host=127.0.0.1 port=5432 user=postgres dbname=postgres
[pgbouncer]
# 监听IP和端口
listen_addr = 192.168.2.9
listen_port = 6432
#日志文件
logfile = /var/log/pgbouncer/pgbouncer.log
#进程文件
pidfile = /var/run/pgbouncer/pgbouncer.pid
#认证类型
auth_type = trust
#认证文件
auth_file = /etc/pgbouncer/userlist.txt
#认证文件
auth_file = /etc/pgbouncer/userlist.txt
#管理用户
admin_users = postgres
#池模式
pool_mode = Transaction



2)建立目录并授权



根据配置文件项目建立目录
auth_file = /etc/pgbouncer/userlist.txt
logfile = /var/log/pgbouncer/pgbouncer.log
pidfile = /var/run/pgbouncer/pgbouncer.pid



mkdir /etc/pgbouncer/
vi /etc/pgbouncer/userlist.txt
# username password
"postgres" "postgres"



mkdir /var/log/pgbouncer
chown -R postgres /var/log/pgbouncer
mkdir /var/run/pgbouncer
chown -R postgres /var/run/pgbouncer



3)启动进程
#su - postgres
$ pgbouncer -d /etc/pgbouncer.ini
2013-12-04 10:55:08.059 15844 LOG File descriptor limit: 1024 (H:1024), max_client_conn: 100, max fds possible: 130
[postgres@gclient ~]$



3.连接测试
#su - postgres
### pgconn 配置文件中连接字符名称
$ psql -p 6432 pgconn
psql (9.3.1)
Type "help" for help.



pgconn=# \d
List of relations
Schema | Name | Type | Owner
--------+------+-------+----------
public | t1 | table | postgres
(1 row)



pgconn=# \q
$



[postgres@gclient ~]$ psql -p 6432 pgbouncer
psql (9.3.1, server 1.5.4/bouncer)
Type "help" for help.



pgbouncer=#



登录管理pgbouncer



$ psql -p 6432 pgbouncer
psql (9.3.1, server 1.5.4/bouncer)
Type "help" for help.



pgbouncer=# show help;
NOTICE: Console usage
DETAIL:
SHOW HELP|CONFIG|DATABASES|POOLS|CLIENTS|SERVERS|VERSION
SHOW STATS|FDS|SOCKETS|ACTIVE_SOCKETS|LISTS|MEM
SHOW DNS_HOSTS|DNS_ZONES
SET key = arg
RELOAD
PAUSE []
RESUME []
KILL
SUSPEND
SHUTDOWN
SHOW
pgbouncer=#


相关阅读



】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Python非常cool的svg格式chart生.. 下一篇你需要知道的、有用的 Python 功..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: