pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
many "cp: cannot stat xxx No such file or directory" logs in warm standby
5+ messages / 4 participants
[nested] [flat]

* many "cp: cannot stat xxx No such file or directory" logs in warm standby
@ 2020-09-28 05:12 Hong Yao <yahoon1982@gmail.com>
  2020-09-28 05:28 ` Re: many "cp: cannot stat xxx No such file or directory" logs in warm standby Ian Barwick <ian.barwick@2ndquadrant.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Hong Yao @ 2020-09-28 05:12 UTC (permalink / raw)
  To: pgsql-admin@lists.postgresql.org

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 directory*
*cp: 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

Does it mean my setup is not correct? How should I fix it?

Thanks in advance!

BR,
Yahoon

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: many "cp: cannot stat xxx No such file or directory" logs in warm standby
  2020-09-28 05:12 many "cp: cannot stat xxx No such file or directory" logs in warm standby Hong Yao <yahoon1982@gmail.com>
@ 2020-09-28 05:28 ` Ian Barwick <ian.barwick@2ndquadrant.com>
  2020-09-29 03:05   ` Re: many "cp: cannot stat xxx No such file or directory" logs in warm standby Hong Yao <yahoon1982@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Ian Barwick @ 2020-09-28 05:28 UTC (permalink / raw)
  To: Hong Yao <yahoon1982@gmail.com>; pgsql-admin@lists.postgresql.org

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





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: many "cp: cannot stat xxx No such file or directory" logs in warm standby
  2020-09-28 05:12 many "cp: cannot stat xxx No such file or directory" logs in warm standby Hong Yao <yahoon1982@gmail.com>
  2020-09-28 05:28 ` Re: many "cp: cannot stat xxx No such file or directory" logs in warm standby Ian Barwick <ian.barwick@2ndquadrant.com>
@ 2020-09-29 03:05   ` Hong Yao <yahoon1982@gmail.com>
  2020-09-29 03:28     ` Re: many "cp: cannot stat xxx No such file or directory" logs in warm standby Julien Rouhaud <rjuju123@gmail.com>
  2020-09-29 03:33     ` many "cp: cannot stat xxx No such file or directory" logs in warm standby David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 2 replies; 5+ messages in thread

From: Hong Yao @ 2020-09-29 03:05 UTC (permalink / raw)
  To: Ian Barwick <ian.barwick@2ndquadrant.com>; +Cc: pgsql-admin@lists.postgresql.org

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
>

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: many "cp: cannot stat xxx No such file or directory" logs in warm standby
  2020-09-28 05:12 many "cp: cannot stat xxx No such file or directory" logs in warm standby Hong Yao <yahoon1982@gmail.com>
  2020-09-28 05:28 ` Re: many "cp: cannot stat xxx No such file or directory" logs in warm standby Ian Barwick <ian.barwick@2ndquadrant.com>
  2020-09-29 03:05   ` Re: many "cp: cannot stat xxx No such file or directory" logs in warm standby Hong Yao <yahoon1982@gmail.com>
@ 2020-09-29 03:28     ` Julien Rouhaud <rjuju123@gmail.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Julien Rouhaud @ 2020-09-29 03:28 UTC (permalink / raw)
  To: Hong Yao <yahoon1982@gmail.com>; +Cc: Ian Barwick <ian.barwick@2ndquadrant.com>; pgsql-admin@lists.postgresql.org

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.

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* many "cp: cannot stat xxx No such file or directory" logs in warm standby
  2020-09-28 05:12 many "cp: cannot stat xxx No such file or directory" logs in warm standby Hong Yao <yahoon1982@gmail.com>
  2020-09-28 05:28 ` Re: many "cp: cannot stat xxx No such file or directory" logs in warm standby Ian Barwick <ian.barwick@2ndquadrant.com>
  2020-09-29 03:05   ` Re: many "cp: cannot stat xxx No such file or directory" logs in warm standby Hong Yao <yahoon1982@gmail.com>
@ 2020-09-29 03:33     ` David G. Johnston <david.g.johnston@gmail.com>
  1 sibling, 0 replies; 5+ messages in thread

From: David G. Johnston @ 2020-09-29 03:33 UTC (permalink / raw)
  To: Hong Yao <yahoon1982@gmail.com>; +Cc: Ian Barwick <ian.barwick@2ndquadrant.com>; pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>

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.

^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2020-09-29 03:33 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-09-28 05:12 many "cp: cannot stat xxx No such file or directory" logs in warm standby Hong Yao <yahoon1982@gmail.com>
2020-09-28 05:28 ` Ian Barwick <ian.barwick@2ndquadrant.com>
2020-09-29 03:05   ` Hong Yao <yahoon1982@gmail.com>
2020-09-29 03:28     ` Julien Rouhaud <rjuju123@gmail.com>
2020-09-29 03:33     ` David G. Johnston <david.g.johnston@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox