pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re. Backup
3+ messages / 3 participants
[nested] [flat]

* Re. Backup
@ 2023-08-03 17:20  Sushil Shirodkar <sushilps@hotmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Sushil Shirodkar @ 2023-08-03 17:20 UTC (permalink / raw)
  To: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>

Hello Friends,

Looking for some help/input regarding backup issue we are having.
Env : PG         => 12.11
         Ubuntu => 20.04.4

We take regular backup along with WALs everyday no issues, but one day of
the week regularly backup fails with the following error.

ERROR:  requested WAL segment 0000000C000008A10000000B has already been removed

We know the reason there is heavy database activity going during this period. But
trying to avoid addition of more WAL files, is there any way to modify our backup
command below which will take just the snapshot and not worry about the WALs?
playing with diff. options but no luck.

pg_basebackup -h ${MASTER_TCP_ADDRESS} -U ${REP_USER} -D ${BACKUP_DIR} -X fetch -Ft -zPw >>$LOG


Thanks in advance,
Sushil...

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

* Re: Re. Backup
@ 2023-08-03 19:01  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: Sushil Shirodkar <sushilps@hotmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Laurenz Albe @ 2023-08-03 19:01 UTC (permalink / raw)
  To: Sushil Shirodkar <sushilps@hotmail.com>; pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>

On Thu, 2023-08-03 at 17:20 +0000, Sushil Shirodkar wrote:
> We take regular backup along with WALs everyday no issues, but one day of
> the week regularly backup fails with the following error.
> 
> ERROR:  requested WAL segment 0000000C000008A10000000B has already been removed
> 
> We know the reason there is heavy database activity going during this period. But
> trying to avoid addition of more WAL files, is there any way to modify our backup
> command below which will take just the snapshot and not worry about the WALs? 
> playing with diff. options but no luck.  
> 
> pg_basebackup -h ${MASTER_TCP_ADDRESS} -U ${REP_USER} -D ${BACKUP_DIR} -X fetch -Ft -zPw >>$LOG

You need the WAL, otherwise you cannot recover the backup.

Use "-X stream" instead of "-X fetch", and the problem will go away.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com





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

* Re: Re. Backup
@ 2023-08-03 19:42  Roland Che <rolandngwa31@gmail.com>
  parent: Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 0 replies; 3+ messages in thread

From: Roland Che @ 2023-08-03 19:42 UTC (permalink / raw)
  To: Laurenz Albe <laurenz.albe@cybertec.at>; +Cc: Sushil Shirodkar <sushilps@hotmail.com>; pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>

Hello Laurenz
If you see from your backup command you are using the fetch option so wals
needed to make your backup consistent( can startup an instance) are backup
after base backup is complete. So by the time wals are to be fetch, some
required segments in the pg_wal directory has been recycled so it’s trying
to fetch but cannot find the wals as it’s removed . So either you use the
stream option which the wals needed will be copied along with the base
backup  or you increase your wal_keep_segment parameter to make sure enough
wals are retained so during fetch , there should still be available in the
pg_wal directory. I had same error before and solve it by increasing my
wal_keep_segment .

On Thu, Aug 3, 2023 at 3:01 PM Laurenz Albe <laurenz.albe@cybertec.at>
wrote:

> On Thu, 2023-08-03 at 17:20 +0000, Sushil Shirodkar wrote:
> > We take regular backup along with WALs everyday no issues, but one day of
> > the week regularly backup fails with the following error.
> >
> > ERROR:  requested WAL segment 0000000C000008A10000000B has already been
> removed
> >
> > We know the reason there is heavy database activity going during this
> period. But
> > trying to avoid addition of more WAL files, is there any way to modify
> our backup
> > command below which will take just the snapshot and not worry about the
> WALs?
> > playing with diff. options but no luck.
> >
> > pg_basebackup -h ${MASTER_TCP_ADDRESS} -U ${REP_USER} -D ${BACKUP_DIR}
> -X fetch -Ft -zPw >>$LOG
>
> You need the WAL, otherwise you cannot recover the backup.
>
> Use "-X stream" instead of "-X fetch", and the problem will go away.
>
> Yours,
> Laurenz Albe
> --
> Cybertec | https://www.cybertec-postgresql.com
>
>
>

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


end of thread, other threads:[~2023-08-03 19:42 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-08-03 17:20 Re. Backup Sushil Shirodkar <sushilps@hotmail.com>
2023-08-03 19:01 ` Laurenz Albe <laurenz.albe@cybertec.at>
2023-08-03 19:42   ` Roland Che <rolandngwa31@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