[pgpool-general: 8320] Re: start/stop pgpool & postgres

Jon SCHEWE jon.schewe at raytheon.com
Sat Jul 9 01:49:41 JST 2022


> Starting and stopping postgres and pgpool.
> I've seen several posts and questions regarding the correct method to use for controlling postgres and pgpool.  I'm referring to the use of pg_ctl, deamon mode/systemd, or other creative ways....
> 
> The problem I've seen is that sometimes these methods do not remain in sync.  You may start postgres with pg_ctl and get false results when running sysemctl status postgresql-<ver>.
> 
> The pgpool scripts all use pg_ctl instead of systemd.
> 
> Is one way better?  Why?

I have recently been doing upgrades and digging into this and found that modifying the scripts to use systemctl and then granting postgres the ability to control the postgresql systemd unit directly has been a good way to go. This keeps it all in sync.

Put this in /etc/polkit-1/rules.d/60-manage-postgres-service.rules to allow postgres to control the systemd unit file.
// Allow postgres to manage postgres.service;
// fall back to implicit authorization otherwise.
polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.systemd1.manage-units" &&
        action.lookup("unit") == "postgresql-14.service" &&
        subject.user == "postgres") {
        return polkit.Result.YES;
    }
});


More information about the pgpool-general mailing list