zoukankan      html  css  js  c++  java
  • pgBouncer

    之前介绍过这个连接池,今天这里只是记录安装配置

    下载地址:http://pgfoundry.org/frs/?group_id=1000258&release_id=1981

    1.安装步骤:

    $ ./configure --prefix=/usr/local --with-libevent=libevent-prefix

    $ make

    $ make install

    如果没有libevent,那么http://monkey.org/~provos/libevent/下载

    Libevent安装:

    $ ./configure && make

    $ make verify

    # make install 注意安装时用root用户

    tail -1f config.log

    configure: exit 0 0说明安装成功,1为失败

    2.创建配置文件:

    Mkdir –p $PGDATA/pgbouncer

    postgres@readerlogdb-> more config.ini

    [databases]

    testdb = host=127.0.0.1 port=1931 dbname=testdb user=testuser password=testuser

    [pgbouncer]

    listen_port = 1688

    listen_addr = 127.0.0.1

    auth_type = md5

    auth_file = /opt/pgdata/pg_root/pgbouncer/user.txt

    logfile = /opt/pgdata/pg_root/pgbouncer/pgbouncer.log

    pidfile = /opt/pgdata/pg_root/pgbouncer/pgbouncer.pid

    pool_mode = Transaction

    admin_users = pgbouncer_admin

    stats_users = pgbouncer_guest

    3.添加用户信息

    more user.txt

    "testuser" "testuser"

    "pgbouncer_admin" "pgbouncer_admin"

    4.启动pgbouncer

    pgbouncer -d /opt/pgdata/pg_root/pgbouncer/config.ini

    5.测试连接

    psql -h 127.0.0.1 -p 1688 -d testdb -U testuser #testuser用户连接testdb

    psql -h 127.0.0.1 -p 1688 -d pgbouncer -U pgbouncer_admin #以pgbouncer管理用户进入本身的数据库pgbouncer

    6.查看相关信息

    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 config; #查看相关配置

    Show stats;

    Show lists;#查看连接相关信息,如,数据库个数,空闲连接数等等

    Show pools;#查看池中连接信息

    Show databases;#查看相关数据库

    Show clients; #查看连接数

    如果修改了配置文件,那么需要reload重新加载

    pgbouncer=# reload;

    RELOAD

    连接方式有三种,之前介绍过,种类不再详述,以上 一些参数的介绍,在源安装包里doc目录下有详细说明和举例。

  • 相关阅读:
    网站术语
    移动web开发入门
    Bootstrap研究3基础html元素
    我所理解的jQuery(3)jQuery的构建
    你好,2011
    Bootstrap研究0概述
    Bootstrap研究2布局系统杂记
    我所理解的jQuery(2)谈jQuery的整体设计,驳"侵入性太强"
    winxp等操作系统下数据库文件 迁移到 win7下,附加时发生Error: 5123 的解决方法
    Bootstrap研究1精巧的网格布局系统
  • 原文地址:https://www.cnblogs.com/javawebsoa/p/3102402.html
Copyright © 2011-2022 走看看