Restarted the server: sudo systemctl restart postgresqlīut the error persisted because, as the logs confirmed, the port did not change: $ tail /var/log/postgresql/postgresql-14-main.log I did however see /var/lib/postgresql/14/main/ so I created it on the same directory with the content: port = 5432 To change the server I looked for the nf mentioned in the documentation but could not find the file. The thin documentation on this (under "Files") was not helpful to me as I was not sure on the syntax and my attempts did not change the client's default, so I moved on. It worked! Now, to make it permanent I'm supposed to put this setting on a psqlrc or ~/.psqlrc file. Let's try it by changing the client's parameters: $ sudo su postgres -c "psql -port=5433" Two alternatives here, get the server to listen on 5432 which is the client's default, or get the client to use 5433. The default port is 5432, but after I upgraded from version 12 to 14, the server was setup to listen to 5433, presumably because it considered 5432 as already taken. This explains how it got into this mess on my system. I confirmed this by running: $ pg_lsclustersġ2 main 5432 down,binaries_missing postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.logġ4 main 5433 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log rw- 1 postgres postgres 70 Oct 29 16:36. Srwxrwxrwx 1 postgres postgres 0 Oct 29 16:36. rw-r-r- 1 postgres postgres 6 Oct 29 16:36 14-main.pid ĭrwxr-s- 2 postgres postgres 40 Oct 29 14:33 12-main.pg_stat_tmpĭrwxr-s- 2 postgres postgres 120 Oct 29 16:59 14-main.pg_stat_tmp I checked what unix sockets I had in that directory: $ ls -lah /var/run/postgresql/ĭrwxrwsr-x 4 postgres postgres 160 Oct 29 16:40. Is the server running locally and accepting connections on that socket? Psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory The directory in my error message is different: $ sudo su postgres -c "psql" This is a client connection problem, as noted by section 19.3.2 in the docs. It seems that you are on Mac, whereas I am running Ubuntu 21.04, so expect things to be different. TroubleshootingĪlthough I cannot provide an answer to your specific problem, I thought I'd share my troubleshooting steps, hoping that it might be of some help. Incidentally, I can recommend the PostgreSQL docker image, which eliminates the need to bother with a local installation. The service was started automatically but it can be done manually with sudo systemctl start postgresql. Ver Cluster Port Status Owner Data directory Log fileġ4 main 5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.logĪnd sudo -u postgres psql works fine. It was something along these lines, on my Ubuntu 21.04 system: sudo pg_dropcluster -stop 12 main I now decided to properly fix it via brute force by removing all clusters and reinstalling, since I didn't have any data there to keep. My original answer only included the troubleshooting steps below, and a workaround.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |