bgw_replstatus
bgw_replstatus : Small PostgreSQL background worker to report whether a node is a replication master or standby
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 6510 | bgw_replstatus
|
bgw_replstatus
|
1.0.8 |
STAT
|
PostgreSQL
|
C
|
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--sL---
|
No
|
Yes
|
Yes
|
No
|
no
|
no
|
| Relationships | |
|---|---|
| See Also | pgautofailover
pglogical
pg_failover_slots
pgpool_recovery
pgsentinel
pglogical_origin
repmgr
pg_jobmon
|
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PGDG
|
1.0.8 |
18
17
16
15
14
|
bgw_replstatus |
- |
| RPM | PGDG
|
1.0.8 |
18
17
16
15
14
|
bgw_replstatus_$v |
- |
| DEB | PGDG
|
1.0.8 |
18
17
16
15
14
|
postgresql-$v-bgw-replstatus |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
el8.aarch64
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
el9.x86_64
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
el9.aarch64
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
el10.x86_64
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
el10.aarch64
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
d12.x86_64
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
d12.aarch64
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
d13.x86_64
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
d13.aarch64
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
u22.x86_64
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
u22.aarch64
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
u24.x86_64
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
u24.aarch64
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
PGDG 1.0.8
|
Source
Install
Make sure PGDG repo available:
pig repo add pgdg -u # add pgdg repo and update cacheInstall this extension with pig:
pig install bgw_replstatus; # install via package name, for the active PG version
pig install bgw_replstatus -v 18; # install for PG 18
pig install bgw_replstatus -v 17; # install for PG 17
pig install bgw_replstatus -v 16; # install for PG 16
pig install bgw_replstatus -v 15; # install for PG 15
pig install bgw_replstatus -v 14; # install for PG 14Config this extension to shared_preload_libraries:
shared_preload_libraries = 'bgw_replstatus';This extension does not need CREATE EXTENSION DDL command
Usage
bgw_replstatus: lightweight replication status checker for load balancers
bgw_replstatus is a background worker that listens on a TCP port and immediately reports whether the node is a MASTER or STANDBY. Designed for load balancer health checks without requiring a full PostgreSQL connection.
How It Works
Any TCP connection to the configured port receives an immediate text response (MASTER or STANDBY) and the connection is closed. No request is needed.
Quick Test
nc localhost 5400
# Output: MASTER (or STANDBY)HAProxy Configuration Example
frontend test
bind 127.0.0.1:5999
default_backend pgcluster
backend pgcluster
mode tcp
option tcp-check
tcp-check expect string MASTER
server s1 127.0.0.1:5500 check port 5400
server s2 127.0.0.1:5501 check port 5401 backup
server s3 127.0.0.1:5502 check port 5402 backupConfiguration
| Parameter | Default | Description |
|---|---|---|
bgw_replstatus.port |
5400 | TCP port to listen on |
bgw_replstatus.bind |
(wildcard) | IP address to bind to |
Security note: There is no source verification. Protect the port with a host firewall.