Bind a L2 VIP to PostgreSQL Primary with VIP-Manager
If all cluster nodes share one L2 network, you can optionally define an L2 VIP for the PostgreSQL cluster.
The VIP uses Master-Backup mode. It always points to the node that runs the cluster primary instance.
VIP-Manager manages the VIP. It reads the Leader Key that Patroni writes to DCS (etcd) to determine whether the local node is primary.
Enable VIP
To enable VIP for a cluster, set pg_vip_enabled to true at cluster level.
You can also enable it globally.
pg_vip_address must be an available, valid IP address with a subnet in the current L2 network.
pg_vip_interface defaults to auto.
With this setting, Pigsty detects each instance interface from its inventory IPv4 address.
If automatic detection is unsuitable for a non-standard or policy-routing environment, specify a valid interface name for each instance. For example:
To refresh the VIP configuration and restart the VIP-Manager, use the following command:
TLS Certificates and SAN
During initial issuance of /pg/cert/server.crt, if pg_vip_enabled / pg_vip_address or node vip_enabled / vip_address is configured, Pigsty adds the mask-free VIP to the server certificate’s Subject Alternative Name (SAN), allowing secure VIP connections with sslmode=verify-full.
Certificate tasks skip reissuance when files/pki/pgsql/<cls>-<seq>.crt already exists on the admin node. If you add or change pg_vip_address after initialization, remove the cluster’s old instance certificate files there, reissue and distribute certificates, then reload PostgreSQL:
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)