cpg
Dépôt relatif aux journées de hacking sur PostgreSQL
cpg · Dépôt relatif aux journées de hacking sur PostgreSQL
Overview
Usage
Sources:
cpg is a Corosync-backed PostgreSQL background-worker experiment. It exchanges primary membership information, updates primary_conninfo, and can ask systemd to promote or stop a node; it is a workshop module rather than a general-purpose HA product.
Core Workflow
The upstream provisioning example installs the library and configures it as follows:
Restart PostgreSQL after adding the library. The worker joins the Corosync group, writes discovered connection state to cpg.auto.conf, and uses the configured systemd service during its failover path.
Important Settings
cpg.intervalis the maximum interval, in seconds, between worker wakeups.cpg.servicenames the systemd service the worker is allowed to manage.cpg.is_user_servicechooses the systemd user bus instead of the system bus.
Requirements and Caveats
- The reviewed control file identifies version
0.1; there is no extension SQL orCREATE EXTENSIONworkflow. - The source requires Corosync CPG and systemd libraries. The demo provisioning also installs a polkit rule so the PostgreSQL account can manage its service.
- The worker can alter replication configuration and trigger promotion or shutdown. Test fencing, quorum loss, stale membership, systemd permissions, and split-brain behavior before any non-lab use.
- This code comes from a PostgreSQL hacking workshop and should be treated as an educational prototype.