Thread: many "cp: cannot stat xxx No such file or directory" logs in warm standby
Hi all
I am setting up a standby server for my PG-12.4 primary server, following the doc https://www.postgresql.org/docs/12/warm-standby.html#STANDBY-SERVER-SETUP (26.2.4. Setting Up a Standby Server"
The OSes are CentOS-7.8
The steps on the standby:
- install postgresql-12 (not initdb)
- run pg_basebackup to fill the data folder
- clean pg_wal folder
- set restore command in postgresql.conf
- restore_command = 'cp /var/pg_wal_archive/%f %p'
- archive_cleanup_command = 'pg_archivecleanup /var/pg_wal_archive %r'
- touch recovery.signal and standby.signal
- start the postgresql-12 service
But in the standalone logs, i see following errors keep repeating:
cp: cannot stat ‘/var/pg_wal_archive/000000020000000000000014’: No such file or directorycp: cannot stat ‘/var/pg_wal_archive/00000003.history’: No such file or directory
Below is the content of archive folder
-rw-------. 1 postgres postgres 16777216 Sep 28 00:36 000000010000000000000014
-rw-------. 1 postgres postgres 16777216 Sep 28 00:28 000000010000000000000013
-rw-------. 1 postgres postgres 16777216 Sep 28 00:27 000000020000000000000013
-rw-------. 1 postgres postgres 42 Sep 28 00:26 00000002.history
-rw-------. 1 postgres postgres 340 Sep 28 00:22 000000010000000000000012.00000028.backup
-rw-------. 1 postgres postgres 16777216 Sep 28 00:22 000000010000000000000012
-rw-------. 1 postgres postgres 16777216 Sep 28 00:22 000000010000000000000011
-rw-------. 1 postgres postgres 16777216 Sep 28 00:18 000000010000000000000010
-rw-------. 1 postgres postgres 16777216 Sep 28 00:28 000000010000000000000013
-rw-------. 1 postgres postgres 16777216 Sep 28 00:27 000000020000000000000013
-rw-------. 1 postgres postgres 42 Sep 28 00:26 00000002.history
-rw-------. 1 postgres postgres 340 Sep 28 00:22 000000010000000000000012.00000028.backup
-rw-------. 1 postgres postgres 16777216 Sep 28 00:22 000000010000000000000012
-rw-------. 1 postgres postgres 16777216 Sep 28 00:22 000000010000000000000011
-rw-------. 1 postgres postgres 16777216 Sep 28 00:18 000000010000000000000010
Does it mean my setup is not correct? How should I fix it?
Thanks in advance!
BR,
Yahoon
Re: many "cp: cannot stat xxx No such file or directory" logs in warm standby
From
Ian Barwick
Date:
On 2020/09/28 14:12, Hong Yao wrote: > Hi all > > I am setting up a standby server for my PG-12.4 primary server, following the doc https://www.postgresql.org/docs/12/warm-standby.html#STANDBY-SERVER-SETUP (26.2.4.Setting Up a Standby Server" > The OSes are CentOS-7.8 > > The steps on the standby: (...) > * set restore command in postgresql.conf > o / restore_command = 'cp /var/pg_wal_archive/%f %p' / > o / archive_cleanup_command = 'pg_archivecleanup /var/pg_wal_archive %r'/ (...) > But in the standalone logs, i see following errors keep repeating: > > /cp: cannot stat ‘/var/pg_wal_archive/000000020000000000000014’: No such file or directory/ > /cp: cannot stat ‘/var/pg_wal_archive/00000003.history’: No such file or directory/ This is expected, as PostgreSQL is speculatively looking for files which may have arrived since the last check. Per the documentation [1]: "The command will be asked for file names that are not present in the archive" [1] https://www.postgresql.org/docs/current//runtime-config-wal.html#GUC-RESTORE-COMMAND Regards Ian Barwick -- Ian Barwick https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
Thank you, Ian.
Is there a way to get rid of these msgs?
Regards,
Yahoon
On Mon, Sep 28, 2020 at 1:28 PM Ian Barwick <ian.barwick@2ndquadrant.com> wrote:
On 2020/09/28 14:12, Hong Yao wrote:
> Hi all
>
> I am setting up a standby server for my PG-12.4 primary server, following the doc https://www.postgresql.org/docs/12/warm-standby.html#STANDBY-SERVER-SETUP (26.2.4. Setting Up a Standby Server"
> The OSes are CentOS-7.8
>
> The steps on the standby:
(...)
> * set restore command in postgresql.conf
> o / restore_command = 'cp /var/pg_wal_archive/%f %p' /
> o / archive_cleanup_command = 'pg_archivecleanup /var/pg_wal_archive %r'/
(...)
> But in the standalone logs, i see following errors keep repeating:
>
> /cp: cannot stat ‘/var/pg_wal_archive/000000020000000000000014’: No such file or directory/
> /cp: cannot stat ‘/var/pg_wal_archive/00000003.history’: No such file or directory/
This is expected, as PostgreSQL is speculatively looking for files which may have
arrived since the last check.
Per the documentation [1]:
"The command will be asked for file names that are not present in the archive"
[1] https://www.postgresql.org/docs/current//runtime-config-wal.html#GUC-RESTORE-COMMAND
Regards
Ian Barwick
--
Ian Barwick https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
Re: many "cp: cannot stat xxx No such file or directory" logs in warm standby
From
Julien Rouhaud
Date:
Le mar. 29 sept. 2020 à 11:05, Hong Yao <yahoon1982@gmail.com> a écrit :
Thank you, Ian.Is there a way to get rid of these msgs?
Please don't top post on this mailing list.
Those logs are harmless, but if you want to get rid of them you simply need to write a small script that first check if the file exists, and exit with a non zero return code if the wanted file doesn't exist.
many "cp: cannot stat xxx No such file or directory" logs in warm standby
From
"David G. Johnston"
Date:
On Monday, September 28, 2020, Hong Yao <yahoon1982@gmail.com> wrote:
Thank you, Ian.Is there a way to get rid of these msgs?
Use something more robust than the bare cp utility as your restore_command. You should consider leveraging open source instead of writing your own.
David J.