psql error connection to server on socket

Issue :

 -bash-4.2$ psql -U postgres -p 4441

psql: error: connection to server on socket "/run/postgresql/.s.PGSQL.4441" fail                                                                                ed: No such file or directory

        Is the server running locally and accepting connections on that socket?


Solution :

- Check your database cluster state, generally we receive this issue only when our db cluster is down state.

Example

Start the database cluster

-bash-4.2$ ls -ltr
total 8
drwx------. 20 postgres postgres 4096 Feb 15 16:59 cluster2 / <your db instance>
drwx------. 20 postgres postgres 4096 Feb 15 18:53 cluster1 / <your db instance>


-bash-4.2$ pg_ctl -D /app01/cluster1/ start
pg_ctl: another server might be running; trying to start server anyway
waiting for server to start....2024-02-16 08:11:45.502 IST [2688] LOG:  redirecting log output to logging collector process
2024-02-16 08:11:45.502 IST [2688] HINT:  Future log output will appear in directory "log".
 done
server started

-bash-4.2$ psql -U postgres -p 4441
psql (14.11)
Type "help" for help.

postgres=# show port;
 port
------
 4441



0 comments:

Post a Comment