postgres@db> psql -h 127.0.0.1 -p 1922 pgbouncer pgbouncer_admin psql (9.1.2, server 1.4.2/bouncer) WARNING: psql version 9.1, server version 1.4. Some psql features might not work. Type "help"for help.
pgbouncer=# show clients; type | user | database | state | addr | port | local_addr | local_port | connect_tim e | request_time | ptr | link ------+-----------------+------------+--------+-----------------------+-------+------------------------+------------+--------------- ------+---------------------+------------+------------ C | skytf | skytf | active | ::ffff:192.168.1.15 | 57791 | ::ffff:192.168.173.215 | 1922 | 2012-03-20 06: 45:28 | 2012-03-20 10:36:31 | 0x1350c9d0 | 0x1352e330
备注:为了格式输出,上面只列出一条记录,例如上面可以看出连接 skytf 库的业务服务器IP为 192.168.1.15,显然通过 pgbouncer 查询客户端 IP 不太方便。