postgresql icon indicating copy to clipboard operation
postgresql copied to clipboard

Changes in PostgreSQL custom systemd config should trigger daemon-reload

Open dracic opened this issue 4 years ago • 7 comments

So I noticed at the first play (CentOS) that configuration settings were not applied because systemd applied settings from data dir instead of /etc:

● postgresql-11.service - PostgreSQL 11 database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql-11.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2019-08-27 08:31:23 CEST; 12min ago
     Docs: https://www.postgresql.org/docs/11/static/
  Process: 22838 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCESS)
  Process: 26353 ExecStartPre=/usr/pgsql-11/bin/postgresql-11-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
 Main PID: 26358 (postmaster)
   CGroup: /system.slice/postgresql-11.service
           ├─26358 /usr/pgsql-11/bin/postmaster -D /var/lib/pgsql/11/data/
           ├─26360 postgres: logger   
           ├─26362 postgres: checkpointer   
           ├─26363 postgres: background writer   
           ├─26364 postgres: walwriter   
           ├─26365 postgres: autovacuum launcher   
           ├─26366 postgres: stats collector   
           └─26367 postgres: logical replication launcher   

Aug 27 08:31:23 dbserver systemd[1]: Starting PostgreSQL 11 database server...
Aug 27 08:31:23 dbserver postmaster[26358]: 2019-08-27 08:31:23.233 CEST [26358] LOG:  listening on IPv6 addre... 5432
Aug 27 08:31:23 dbserver postmaster[26358]: 2019-08-27 08:31:23.233 CEST [26358] LOG:  listening on IPv4 addre... 5432
Aug 27 08:31:23 dbserver postmaster[26358]: 2019-08-27 08:31:23.236 CEST [26358] LOG:  listening on Unix socke...5432"
Aug 27 08:31:23 dbserver postmaster[26358]: 2019-08-27 08:31:23.241 CEST [26358] LOG:  listening on Unix socke...5432"
Aug 27 08:31:23 dbserver postmaster[26358]: 2019-08-27 08:31:23.259 CEST [26358] LOG:  redirecting log output ...ocess
Aug 27 08:31:23 dbserver postmaster[26358]: 2019-08-27 08:31:23.259 CEST [26358] HINT:  Future log output will...log".
Aug 27 08:31:23 dbserver systemd[1]: Started PostgreSQL 11 database server.
Warning: postgresql-11.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Hint: Some lines were ellipsized, use -l to show in full.

So we need extra handler for systemd config reload, and 'PostgreSQL | Use the conf directory when starting the Postgres service | RedHat' task should notify it on every systemd config change.

dracic avatar Aug 27 '19 07:08 dracic

Ok, I'm fixing this. But errors that popped out for Fedora weren't caused by my commits.

dracic avatar Aug 27 '19 08:08 dracic

Build fail related to: #444

dracic avatar Aug 27 '19 08:08 dracic

For centOS 6 (or other RHEL upstart) service manager we need /etc/sysconfig/pgsql/clustername template to override default variables:

PGENGINE=/usr/pgsql-9.5/bin
PGDATA=/var/lib/pgsql/9.5/data
PGLOG=/var/lib/pgsql/9.5/pgstartup.log
# Log file for pg_upgrade
PGUPLOG=/var/lib/pgsql/$PGMAJORVERSION/pgupgrade.log

lockfile="/var/lock/subsys/${NAME}"
pidfile="/var/run/${NAME}.pid"

# Override defaults from /etc/sysconfig/pgsql if file is present
[ -f /etc/sysconfig/pgsql/${NAME} ] && . /etc/sysconfig/pgsql/${NAME}

dracic avatar Aug 27 '19 11:08 dracic

I made a mess with commits, but now it works with CentOS 6 and 7.

dracic avatar Aug 29 '19 06:08 dracic

Could you rebase this against master (with #447), as Fedora was killing the build

gclough avatar Sep 09 '19 14:09 gclough

Rebase done!

dracic avatar Oct 08 '19 11:10 dracic

This pr has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

github-actions[bot] avatar Feb 19 '24 23:02 github-actions[bot]

This pr has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.

github-actions[bot] avatar Apr 19 '24 23:04 github-actions[bot]