Can someone give a detailed explanation of how the postgresql
service(s) works on Ubuntu [16.04]? The behavior that leads me to ask is the following. I use the command sudo systemctl start postgresql
to start my postgresql service. When I run systemctl list-units | grep post
I see
UNIT LOAD ACTIVE SUB DESCRIPTION
postgresql.service loaded active exited PostgreSQL RDBMS
postgresql@9.6-main.service loaded active running PostgreSQL Cluster 9.6-main
system-postgresql.slice loaded active active system-postgresql.slice
and when I run sudo systemctl stop postgresql
both postgresql.service
and postgresql@9.6-main.service
disappear. What is each of these three services doing?
I assume postgresql@9.6-main.service
is registered service for PostgreSQL Cluster 9.6-main
cluster. This is the one that actually controls postgres on your system.
I assume postgresql.service
is the effect desribed here
I assume system-postgresql.slice
is a postgres slice unit
none of above are critical for running postgres. You can start/stop the cluser with just pg_ctl
, without registering it with your services. But if you wonder which service runs it in your case - then it is postgresql@9.6-main.service