PostgreSQL Educational Bramble
If you want use pg_ctlcluster to control the postgres service (to start/stop/restart it), it is necessary to download and install a more up to date version of postgresql-common and postgresql-client-common. The new versions fix an issue regarding systemd not recognizing when the postgres service was controlled by pg_ctlcluster.
wget http://apt.postgresql.org/pub/repos/apt/pool/main/p/pgdg-keyring/pgdg-keyring_2014.1_all.deb
wget http://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-common/postgresql-client-common_175.pgdg80%2b1_all.deb
wget http://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-common/postgresql-common_175.pgdg80%2b1_all.deb
dpkg -i *.deb
To avoid this and to make things easier, the handlers on this playbook use postgresql@/, eg. [email protected]/main, as the service for start/restart postgres. There is a problem on the current version of Raspbian where systemd doesn't work properly when postgresql.service is used.
Therefore, using the following form is the recommended way when postgresql-common and postgresql-client-common are not updated:
systemctl status [email protected]
Just as an example, the correspondent pg_ctlcluster command will be (launching as root):
pg_ctlcluster 9.4 main start