PgPool-II Logo

PgPool-II: open-source middleware that extends PostgreSQL

PostgreSQL is a powerful, open source object-relational Database system with a strong reputation for reliability, feature robustness, and performance. PgPool-II is a middleware that sits between PostgreSQL servers and a PostgreSQL database client that extends PostgreSQL with clustering capabilities and provide many features like: Connection Pooling, Load Balancing, Replication, Automated Fail Over and Recovery, etc.
Written in: C

Download PgPool-II: Source Code

License: OpenSource PgPool-II License (BSD)

Project Website: pgpool.net

Documentation: pgpool.net/docs/latest

Project Goals
  • PgPool-II is a middleware that works between PostgreSQL server(s) and client(s).
Project Features
  • PgPool-II extends PostgreSQL functionality so it can manage a cluster
  • There are also other features that are provided by PgPool-II for PostgreSQL auch as:
    • connection pooling
    • load balancing
    • automated fail over and recovery
    • replication
    • watchdog
    • in-memory-cache.
Project Design and Security
  • Pgpool-II speaks PostgreSQL's backend and frontend protocol, and relays messages between a backend and a frontend.

Sample Configuration
## Sample Configuration for PgPool-II @ /etc/pgpool.conf

# - pgpool Connection Settings -
listen_addresses = 'localhost'
port = 5433
socket_dir = '/tmp'
listen_backlog_multiplier = 2
serialize_accept = off

# - pgpool Communication Manager Connection Settings -
pcp_listen_addresses = '*'
pcp_port = 9898
pcp_socket_dir = '/tmp'

# - Backend Connection Settings -
backend_hostname0 = 'localhost'
backend_port0 = 5432
backend_weight0 = 1
backend_data_directory0 = '/var/lib/pgsql/data'
backend_flag0 = 'ALLOW_TO_FAILOVER'

# - Authentication -
enable_pool_hba = off
pool_passwd = 'pool_passwd'
authentication_timeout = 60

# - SSL Connections -
ssl = off

# - Concurrent session and pool size -
num_init_children = 32
max_pool = 4

# - Life time -
child_life_time = 300
child_max_connections = 0
connection_life_time = 0
client_idle_limit = 0

# - Where to log -
log_destination = 'stderr'

# - What to log -
log_line_prefix = '%t: pid %p: '
log_connections = off
log_hostname = off
log_statement = off
log_per_node_statement = off
log_standby_delay = 'none'

# - Syslog specific -
syslog_facility = 'LOCAL0'
syslog_ident = 'pgpool'

# FILE LOCATIONS
pid_file_name = '/var/run/pgpool/pgpool.pid'
logdir = '/var/log/pgpool'

# CONNECTION POOLING
connection_cache = on
reset_query_list = 'ABORT; DISCARD ALL'

## END