Real head scratcher today that I am hoping someone might be able to help out with. I have an Ubuntu 22.04 LTS
server and I am trying to install and configure postgressql
on the server. The intent is for it to be used as an archive for older, larger DBs that don't need to be quickly accessed.
We built the server with two disks (virtual disks) one smaller one for the OS and then a second (2TB drive) for the postgres DBs to be stored. I was able to add the second disk and then format it to NTFS
and then mount it to /mnt/Postgres_DB_Archive_MP/
. I am not 100% certain I did it properly, so that might be apart of the issues I am running into. I used this guide on how to add the disk via Cockpit
Anyways, I followed this guide to install and configure postgres. I was able to switch to the postgres
user, connect, create a new user and a new DB all without issues. However this had the data directory being stored on the OS drive.
So then I followed this guide to migrate the data over to the larger drive. I was able to follow the steps without issue, however when I go to switch to the postgres
user and then run psql
I get the following error:
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
Which then led me on a number of hunts to try and find out what it might be. I used this thread to get me to the /var/log/postgresql/postgresql/14/main.log
file which didn't have any useful information in it other then error code 1 and that the DB was down. Here is the full output:
2022-11-02 15:52:10.035 EDT [3875] LOG: starting PostgreSQL 14.5 (Ubuntu 14.5-0ubuntu0.22.04.1) on x86_64-p
2022-11-02 15:52:10.035 EDT [3875] LOG: listening on IPv4 address "127.0.0.1", port 5432
2022-11-02 15:52:10.038 EDT [3875] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2022-11-02 15:52:10.047 EDT [3876] LOG: database system was shut down at 2022-11-02 15:52:07 EDT
2022-11-02 15:52:10.056 EDT [3875] LOG: database system is ready to accept connections
2022-11-02 15:55:08.792 EDT [3875] LOG: received fast shutdown request
2022-11-02 15:55:08.797 EDT [3875] LOG: aborting any active transactions
2022-11-02 15:55:08.801 EDT [3875] LOG: background worker "logical replication launcher" (PID 3882) exited
2022-11-02 15:55:08.801 EDT [3877] LOG: shutting down
2022-11-02 15:55:08.838 EDT [3875] LOG: database system is shut down
Then I tried using pg_lsclusters
to start the database, and the command appeared to run successfully however the DB still showed a status of down.
Ver Cluster Port Status Owner Data directory Log file
14 main 5432 down root /mnt/Postgres_DB_Archive_MP /var/log/postgresql/postgresql-14-main.log
Any ideas what I am doing wrong? Or what I can do to just install postgres on the secondary drive in the first place? Since posting this thread, I have completely removed postgres
and plan on starting fresh using any advice I can find.