How to restart PostgreSQL via ssh console?
When i search this thing on SO I only find: postgres, ubuntu how to restart service on startup? get stuck on clustering after instance reboot
24 Answers
sudo service postgresql restart systemctl restart postgresql@<postgres_version>-<cluster_name>.service By default cluster_name = 'main', run this command to list all the clusters you have :
ls /var/lib/postgresql/ if you want to know whether the postgresql is running try this command :
systemctl status postgresql@<postgres_version>-<cluster_version>.service 1My postgresql service is named postgresql-9.5; in case you get "postgresql: unrecognized service" you can find its name with
sudo service --status-all | grep postgresql and then proceed as per the accepted answer.
2The problem is with your remote configuration
sudo nano /etc/postgresql/13/main/postgresql.conf Uncomment line 59 and change the Listen address to accept connections within your networks. *
#Listen on all interfaces
listen_addresses = '*'
#Listen on specified private IP address
listen_addresses = '192.168.10.11`