pgbouncer #2
Description
PgBouncer is a lightweight connection pooler for PostgreSQL.
- Tags:
- databases ›
Overview
PgBouncer is a lightweight connection pooler for PostgreSQL.
http://wiki.postgresql.org/wiki/PgBouncer
Usage
Installation
To deploy you'll need at a minimum: a cloud environment, a working Juju installation, and a successful bootstrap. Please refer to the Juju Getting Started documentation before continuing.
It is also recommended that you read the documentation for the postgresql charm so you understand how to set up postgresql in a master-slave relationship.
juju deploy cs:postgresql
juju deploy cs:~postgresql-charmers/pgbouncer
juju deploy cs:~postgresql-charmers/postgresql-client psql
juju add-relation postgresql:db-admin pgbouncer:backend-db-admin
juju add-relation psql:db pgbouncer:db # Or db-admin
Charming
The pgbouncer charm implements the same interface as the PostgreSQL charm.
See the PostgreSQL Client Interface
for details. Both charms provide the db
(standard privileges)
and db-admin
(administrative privileges) relations, and may be used
interchangably.
Configuration
See config.yaml
for configuration options. Further details may be
found in the pgbouncer documentation
Monitoring
This charm provides relations that support monitoring via Nagios using
cs:nrpe_external_master
as a subordinate charm.
Support
This charm is maintained by Stuart Bishop on Launchpad. Please use the main Juju mailing list for general discussions.
Source is available in git at https://git.launchpad.net/pgbouncer-charm.
Bugs should be reported in the Launchpad Bugtracker.
Configuration
- client_login_timeout
- (int) If a client connects but does not manage to login in this amount of time, it will be disconnected. Mainly needed to avoid dead connections stalling SUSPEND and thus online restart. [seconds]
- 60
- conn_crit
- (int) The parameters to pass to the nrpe plugin check_pgbouncer_connection_count for critical level.
- 90
- conn_warn
- (int) The parameters to pass to the nrpe plugin check_pgbouncer_connection_count for warn level.
- 75
- default_pool_size
- (int) How many server connections to allow per user/database pair. Can be overridden in the per-database configuration.
- 20
- extra_packages
- (string) Space separated list of extra deb packages to install.
- ignore_startup_parameters
- (string) By default, PgBouncer allows only parameters it can keep track of in startup packets - client_encoding, datestyle, timezone and standard_conforming_strings. All other parameters will raise an error. To allow other parameters, they can be specified here, so that pgbouncer knows that they are handled by admin and it can ignore them.
- application_name
- install_keys
- (string) List of signing keys for install_sources package sources, per charmhelpers standard format (a yaml list of strings encoded as a string). The keys should be the full ASCII armoured GPG public keys. While GPG key ids are also supported and looked up on a keyserver, operators should be aware that this mechanism is insecure. null can be used if a standard package signing key is used that will already be installed on the machine, and for PPA sources where the package signing key is securely retrieved from Launchpad.
- install_sources
- (string) List of extra apt sources, per charm-helpers standard format (a yaml list of strings encoded as a string). Each source may be either a line that can be added directly to sources.list(5), or in the form ppa:<user>/<ppa-name> for adding Personal Package Archives, or a distribution component to enable.
- listen_port
- (int) Which port to listen on. Applies to both TCP and Unix sockets.
- 6432
- max_client_conn
- (int) Maximum number of client connections allowed. When increased then the file descriptor limits should also be increased. Note that actual number of file descriptors used is more than max_client_conn.
- 100
- nagios_context
- (string) Used by the nrpe subordinate charms. A string that will be prepended to instance name to set the host name in nagios. So for instance the hostname would be something like: juju-myservice-0 If you're running multiple environments with the same services in them this allows you to differentiate between them.
- juju
- nagios_servicegroups
- (string) A comma-separated list of nagios servicegroups. If left empty, the nagios_context will be used as the servicegroup
- package_status
- (string) The status of service-affecting packages will be set to this value in the dpkg database. Valid values are "install" and "hold".
- install
- pool_mode
- (string) Specifies when a server connection can be reused by other clients.
- transaction
- reserve_pool_size
- (int) How many additional connections to allow to a pool. 0 disables.
- server_check_delay
- (int) How long to keep released connections available for immediate re-use, without running sanity-check queries on it. If 0 then the query is ran always.
- 30
- server_connect_timeout
- (int) If connection and login wont finish in this amount of time, the connection will be closed. [seconds]
- 15
- server_idle_timeout
- (int) If a server connection has been idle more than this many seconds it will be dropped. If 0 then timeout is disabled. [seconds]
- 600
- server_lifetime
- (int) The pooler will try to close server connections that have been connected longer than this. Setting it to 0 means the connection is to be used only once, then closed. [seconds]
- 3600
- server_login_retry
- (int) If login failed, because of failure from connect() or authentication that pooler waits this much before retrying to connect. [seconds]
- 15
- wait_crit
- (int) The parameters to pass to the nrpe plugin check_pgbouncer_pool_waittime for critical level.
- 20
- wait_warn
- (int) The parameters to pass to the nrpe plugin check_pgbouncer_pool_waittime for warning level.
- 5