Skip to main content

pgagroal manual · How-to · upstream 2.1.0

Health checks

From the upstream pgagroal manual, rendered in the Elevarq documentation style. Single-sourced from the pinned pgagroal release.

\newpage

[pgagroal][pgagroal] can periodically check the health of the [PostgreSQL][postgresql] instances in the pool. If a server is found to be down, it will be marked as such, and connections will be routed to other available servers.

Configuration

The health check behavior is controlled by the following parameters in the [pgagroal] section of pgagroal.conf:

Security and User Setup

Health checks are performed by connecting to a database within the target cluster, which requires user credentials. Using an unprivileged user to connect is the recommended and more secure way to configure the health check feature.

Option 1: Superuser

Using the existing database superuser (e.g., postgres) is the simplest way to get started.

Pros

Cons

Option 2: Dedicated Unprivileged User

Creating a dedicated, restricted user is the recommended and more secure approach.

Pros

Cons

Setup Steps

To set up a dedicated health check user:

Best Practices

Monitoring

The health status of each server is exposed via the Prometheus metrics endpoint (pgagroal_server_health).

The metric includes an auth label identifying the authentication method used during the last successful probe (e.g., trust, md5, scram-sha-256).