背景:
阅读新闻
Linux 平台安装PgBouncer说明文档
[日期:2013-12-24] 来源:Linux社区 作者:heyiyi [字体:]
1.安装libevent
下载网址:
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
下载网址:
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 [<db>]
RESUME [<db>]
KILL <db>
SUSPEND
SHUTDOWN
SHOW
pgbouncer=#
相关阅读:
Python非常cool的svg格式chart生成库pygal
相关资讯 PgBouncer
本文评论 查看全部评论 (0)
尊重网上道德,遵守中华人民共和国的各项有关法律法规 承担一切因您的行为而直接或间接导致的民事或刑事法律责任 本站管理人员有权保留或删除其管辖留言中的任意内容 本站有权在网站内转载或引用您的评论 参与本评论即表明您已经阅读并接受上述条款
评论声明
最新资讯