Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have a postgres 9.1 hot-standby that has been down for a few days and having problems starting back up. When I try to restart the server I see the following:

-sh-4.1$ /usr/local/pgsql/bin/pg_ctl start -D /usr/local/pgsql/data
server starting
-sh-4.1$ LOG:  database system was shut down in recovery at 2013-02-13 05:11:29 UTC
LOG:  entering standby mode
cp: cannot stat `/usr/local/pgsql/wals/000000010000003B000000BA': No such file or directory
LOG:  redo starts at 3B/BA0022E0
LOG:  record with zero length at 3B/BA820590
cp: cannot stat `/usr/local/pgsql/wals/000000010000003B000000BA': No such file or directory
LOG:  streaming replication successfully connected to primary

What does this mean? Why isn't the standby getting the data it needs from the master and making itself available? Any suggestions on how to diagnose and resolve? Thanks

share|improve this question

migrated from stackoverflow.com Feb 13 '13 at 8:15

This question came from our site for professional and enthusiast programmers.

    
If I terminal in with another window and try to console in I get "psql: FATAL: the database system is starting up" –  AnApprentice Feb 13 '13 at 5:20
    
But it seems to never start up... –  AnApprentice Feb 13 '13 at 5:20
add comment

2 Answers

Although this message could look like an error:

cp: cannot stat `/usr/local/pgsql/wals/000000010000003B000000BA': No such file or directory

it's actually harmless, it's just the way of your restore_command to check for a new WAL file that's not necessarily there yet. Presumably this command looks like:

cp /usr/local/pgsql/wals/%f "%p"

Should you want to get rid of that message, you could provide a more sophisticated version of the command to silently check for the existence of the file before attempting to copy it.

In the rest of the log output, there is nothing that looks wrong. If it's a hot standby, you should be able to connect to it with psql.

share|improve this answer
add comment

My guess is that the recovery process is not completing fully yet. The warning you are getting about cp not working is likely relevant in that it may be waiting for a WAL segment that isn't there.

You may want to take a look for the relevant WAL file somewhere and put it where it is expected. Otherwise use pg_basebackup to rebuild your replica.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.