2

When I run sudo -u postgres psql it gives error as

psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

So I check status by pg_lsclusters ,it gives status as down

So I tried to start the cluster by sudo pg_ctlcluster 11 main start,it gives error as

Job for [email protected] failed because the service did not take 
the steps required by its unit configuration.
See "systemctl status [email protected]" and "journalctl -xe" for 
details.

Then I check log by journalctl -xe ,it gives

-- Subject: Unit [email protected] has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit [email protected] has begun starting up.
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: Error: 
/usr/lib/postgresql/11/bin/pg_ctl /usr/lib/postgresql/11/bin/pg_ctl start -D 
/data/aqu
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 
18:35:50.032 UTC [3622] LOG:  listening on IPv4 address "0.0.0.0", port 5432
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 
18:35:50.032 UTC [3622] LOG:  listening on IPv6 address "::", port 5432
 May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 
 18:35:50.033 UTC [3622] LOG:  listening on Unix socket 
 "/var/run/postgresql/.s.PGS
 May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 
 18:35:50.090 UTC [3623] LOG:  database system shutdown was interrupted; 
 last known
 May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 
18:35:50.140 UTC [3623] LOG:  database system was not properly shut down; 
automati
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 
18:35:50.147 UTC [3623] LOG:  redo starts at 9D/44F48998
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 
 18:35:53.483 UTC [3624] a2i@postgres FATAL:  the database system is 
 starting up
 May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 
 18:35:54.422 UTC [3625] a2i@postgres FATAL:  the database system is 

starting up
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:35:55.461 UTC [3626] a2i@postgres FATAL:  the database system is starting up
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:35:55.465 UTC [3627] a2i@postgres FATAL:  the database system is starting up
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:35:57.713 UTC [3628] a2i@postgres FATAL:  the database system is starting up
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:35:57.861 UTC [3623] LOG:  redo done at 9D/AFFFFF98
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:35:59.416 UTC [3629] a2i@postgres FATAL:  the database system is starting up
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:36:03.493 UTC [3630] a2i@postgres FATAL:  the database system is starting up
May 08 18:36:07 ip-10-0-1-87 postgresql

@11-main[3617]: 2019-05-08 18:36:04.431 UTC [3631] a2i@postgres FATAL:  the database system is starting up
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:36:05.471 UTC [3632] a2i@postgres FATAL:  the database system is starting up
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:36:05.477 UTC [3633] a2i@postgres FATAL:  the database system is starting up
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:36:06.776 UTC [3623] PANIC:  could not write to file "pg_wal/xlogtemp.3623": No
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:36:06.959 UTC [3622] LOG:  startup process (PID 3623) was terminated by signal
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:36:06.959 UTC [3622] LOG:  aborting startup due to startup process failure
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:36:07.108 UTC [3622] LOG:  database system is shut down
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: pg_ctl: could not start server
May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: Examine the log output.
May 08 18:36:07 ip-10-0-1-87 systemd[1]: [email protected]: Can't open PID file /var/run/postgresql/11-main.pid (yet?) after start: No such
May 08 18:36:07 ip-10-0-1-87 systemd[1]: [email protected]: Failed with result 'protocol'.
May 08 18:36:07 ip-10-0-1-87 systemd[1]: Failed to start PostgreSQL Cluster 11-main.
-- Subject: Unit [email protected] has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit [email protected] has failed.
--
-- The result is RESULT.
May 08 18:36:07 ip-10-0-1-87 sudo[3612]: pam_unix(sudo:session): session closed for user root

It may cause because of shutting down database improperly I don't need solution like taking dump of existing database and reinstall postgres and restore it..I have big data , it will take much. What will be the soultion to sort this?

1
  • Have you though about running it inside a docker container? Commented May 8, 2019 at 21:00

1 Answer 1

4

It says in the logs what the problem is:

May 08 18:36:07 ip-10-0-1-87 postgresql@11-main[3617]: 2019-05-08 18:36:06.776 UTC [3623] PANIC:  could not write to file "pg_wal/xlogtemp.3623": No

I can't see what comes after "No" because it looks like you cut off that part of the message.

However, the database server is unable to write to the transaction logs directory and is quite sensibly refusing to continue. Stop what you are doing, take a complete backup of all the files in your data directory and below and then and only then figure out what the problem is.

You don't know what you are doing (or you wouldn't be posting here without reading the error log) and there is a good chance that anything else you do will make the situation worse.

Obvious things to check:

  • Has the machine crashed recently?
  • Have you run out of disk space?
  • Have permissions on the directories been changed?
Sign up to request clarification or add additional context in comments.

4 Comments

Log is : -** could not write to file "pg_wal/xlogtemp.4849": No space left**
Has the machine crashed recently?-yes ..Have you run out of disk space?-It was so increased it that's when this issue start coming
"No space left" says you are still out of disk space somehow. Do make sure you have taken that backup before doing anything else.
Yes. Thanks I solved it..I increased the volume but not on file system

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.