Skip to content

Instantly share code, notes, and snippets.

@mowings
Last active February 2, 2018 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mowings/a1b7181ee3033f5f3d372a993a3415f7 to your computer and use it in GitHub Desktop.
Save mowings/a1b7181ee3033f5f3d372a993a3415f7 to your computer and use it in GitHub Desktop.
postgres and systemd

systemd's logind by default will kill off all ipc objects associated with a user when that user logs out. This includes the postgres user -- which the postgres daemon runs as. Thus if you login in as postgres (for example to do some db maintenance) then postgres itself will crash as soon as you log out, since logind kills off all shared memory segments belonging to the postgres user. This crashes all postgres processes, and the system goes into recovery to the last good commit. You should turn this behavior off for any postgres host that uses systemd:

In /etc/systemd/logind.conf set

RemoveIPC=no

then restart logind

systemct restart systemd-logind
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment