News & Blog back


PgbConsole – admin console for PgBouncers.

pgbConsole – top-like PgBouncer admin console.

If you work with PostgreSQL you have probably heard about PgBouncer – a lightweight connection pooler for PostgreSQL. PgBouncer is often used in situations of a large number of connections to the database. And its use is usually justified. Using PgBouncer can reduce the use of resources by reducing the number of direct connections to the database.
PgBouncer has an integrated management interface that allows to manage connection pooling and browse various statistics. To use this interface, you need to connect to the control database (called pgbouncer) using a psql utility and execute the appropriate command. The problem becomes more complicated if you have several PgBouncers and need manage them simultaneously. You can get lost in the psql consoles and enter a command in a wrong place.
To simplify working with multiple PgBouncers I want to introduce the PgbConsole utility (note, that the pgbConsole already included into pg-utils – useful PostgreSQL utilities). This top-like utility that shows PgBouncer states and allows manage them in real time. PgbConsole uses libpq library to connect and work with PgBouncers. Currently, most necessary commands are available, such as PAUSE/RESUME/SUSPEND/KILL/RELOAD/SHUTDOWN. These commands are executed by pressing the hot keys. Also command to display the statistics are supported: SHOW CLIENTS/SERVERS/DATABASES/POOLS/STATS. The results of these commands are displayed continuously in a separate section of the screen. Use hotkeys to switch between the SHOW modes. A view of current configuration (SHOW CONFIG) is also available via hotkey. If PgbConsole runs on the same host where PgBouncer runs, you can view logfile and edit the configuration file.
And of course you can connect to other PgBouncer directly from the program (or close an existing connection). For further work, you can save the current connections settings in the configuration file (~/.pgbrc). The next time when you run PgbConsole, it will read parameters from this file and open the necessary connections.

I hope it will be helpful. 

You may also like: