How to restart PostgreSQL in Ubuntu 18.04

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

2

4 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 
1

My 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.

2

The 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`

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like