Install Pgpool-II for PostgreSQL on CentOS: How-To Guide

Updated

Installing Pgpool-II on CentOS

Install Pgpool-II on a RHEL-family host from the pgpool.net Yum repository, not EPEL, and start the unit called pgpool — not pgpool-II. Point your application at port 9999:

sudo dnf install -y https://www.pgpool.net/yum/rpms/4.7/redhat/rhel-9-x86_64/pgpool-II-release-4.7-1.noarch.rpm
sudo dnf install -y pgpool-II-pg17          # match your PostgreSQL major version
sudo systemctl enable --now pgpool
psql -h 127.0.0.1 -p 9999 -U youruser -c "SHOW POOL_NODES;"

Do not install pgpoolAdmin. A walkthrough that drops that web panel into /var/www/html behind an Apache <VirtualHost *:80> containing Require all granted, AllowOverride All and no authentication directive of any kind leaves you with an unauthenticated control panel for your database cluster, served over plain HTTP to anyone who can reach the box.

First: “CentOS” no longer means CentOS Linux

CentOS Linux — the free RHEL rebuild — is over. The CentOS Project’s own notice states CentOS Linux 8 reached End Of Life on 31 December 2021; CentOS Linux 7 followed on 30 June 2024. The download page at centos.org now offers only CentOS Stream 10 (end-of-life 2030-05-31) and CentOS Stream 9 (end-of-life 2027-05-31), described there as a distro that “tracks just ahead of Red Hat Enterprise Linux (RHEL) development.”

So a 2026 reader on a “CentOS” guide is on one of three things:

  • CentOS Stream 9 or 10 — supported, use the rhel-9 or rhel-10 repository path above.
  • Rocky Linux or AlmaLinux — the community RHEL rebuilds that took over CentOS Linux’s role. Same RPMs, same repository paths.
  • A CentOS 7 or 8 box still running — unpatched for years. Migrating it matters more than pooling its connections.

Why neither EPEL nor pgpool-II-extensions installs Pgpool-II

The commands sudo yum install -y epel-release followed by sudo yum install -y pgpool-II-extensions cannot install Pgpool-II. Two problems, both checked on 10 August 2026:

EPEL does not carry Pgpool-II. The EPEL 9 package index for x86_64 contains zero packages matching pgpool. Adding epel-release accomplishes nothing here.

pgpool-II-extensions is not a package name, and the thing it resembles is not the server. The pgpool.net repository names its packages per PostgreSQL major version: pgpool-II-pg14 through pgpool-II-pg18, each with a matching -extensions subpackage. I downloaded pgpool-II-pg17-extensions-4.7.2 and listed it: every file lands under /usr/pgsql-17/ and is either pgpool_adm or pgpool-recovery — PostgreSQL server-side extensions, meant for the backend database hosts. No pgpool binary, no systemd unit, nothing that pools anything. The daemon lives in pgpool-II-pg17.

Pick the one matching the backend you actually run. The backend’s own repository is organised the same way — the PGDG repository RPM is published per EL major version — and the release that page checked as EOL is 13.

The service is pgpool, and the config is where you expected

sudo systemctl start pgpool-II will fail. Unpacking pgpool-II-pg17-4.7.2-1pgdg.rhel9.x86_64.rpm shows exactly one unit file, /usr/lib/systemd/system/pgpool.service:

User=postgres
ExecStart=/usr/bin/pgpool -f /etc/pgpool-II/pgpool.conf $OPTS
ExecStop=/usr/bin/pgpool -f /etc/pgpool-II/pgpool.conf $STOP_OPTS stop

The config file is /etc/pgpool-II/pgpool.conf. The RPM also ships pcp.conf, pool_hba.conf, pool_passwd and a sample_scripts/ directory there, plus /etc/sudoers.d/pgpool granting postgres passwordless ip and arping for watchdog VIP failover.

Settings whose defaults break failover

Setting listen_addresses, backend_hostname, backend_port and backend_weight is not the whole job. Reading the pgpool.conf the RPM actually installs:

  • #health_check_period = 0 — commented out, and 0 means health checking is disabled. Until you set it, Pgpool-II never notices a dead backend and the automatic failover you installed it for never fires.
  • #port = 9999 and #listen_addresses = 'localhost' — clients still pointed at 5432 silently bypass the pool and talk straight to a backend. Everything works until failover, then it doesn’t.
  • #load_balance_mode = on — commented, so you inherit a default that changed between releases. Set it explicitly.
  • pcp.conf is required for administration. Without a populated one there is no pcp_node_info, no pcp_attach_node, and no way to bring a recovered node back. The RPM installs all 15 pcp_* tools plus pg_md5 and pg_enc for generating its entries.

Where the logs are on RHEL-family hosts

Unlike the Debian package, this RPM’s shipped config turns the collector on: logging_collector = on with log_directory = '/var/log/pgpool', and the RPM creates that directory. So tail -f /var/log/pgpool/pgpool.log is correct here even though it is wrong on Ubuntu. journalctl -u pgpool still catches startup failures that happen before the collector is running.

Managing the cluster without a web panel

Connected on 9999, SHOW POOL_NODES; lists every backend with status, role, weight, SELECT counts and replication delay. pcp_node_info, pcp_detach_node, pcp_attach_node and pcp_watchdog_info administer the cluster over port 9898 against pcp.conf. CREATE EXTENSION pgpool_adm; exposes the same commands as SQL functions — the supported way to build a UI.

What was verified, and what was not

Executed here: unpacking the real pgpool-II-pg17 and pgpool-II-pg17-extensions RPMs for RHEL 9 and reading their unit file, config defaults and file lists; listing the pgpool.net repository index; searching the EPEL 9 index; and fetching the CentOS pages for the dates above. The same steps are in install-pgpool-ii-centos.sh; it unpacks the RPMs in a temporary directory that is deleted when it finishes, and the dnf install, SHOW POOL_NODES and failover claims appear in its output as skips because they need a RHEL-family host or a running cluster.

Not run here: Pgpool-II itself. This machine is macOS with no Linux host and no container runtime, so no dnf install, no failover test and no PCP session took place. The dnf commands at the top are constructed from the verified package and unit names, not from a successful install — check the repository index for the release path that matches your PostgreSQL major before running them, and test failover in staging. A health check that is configured but never exercised is not meaningfully different from one that is disabled.

Photo of author
Sudhir P. founded HeatWare.com in 1999 and has built and operated it full-stack ever since; it is now used by more than 88,000 people. He writes here about the PostgreSQL, MySQL, Linux and DevOps work that keeps it running. Articles are rewritten only after the commands in them have actually been run, and the verification scripts are published alongside them so anyone can check the claims. Reach him at blog@heatware.net.