pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Automate pg_basebackup in linux
7+ messages / 6 participants
[nested] [flat]

* Automate pg_basebackup in linux
@ 2021-06-05 17:14  SMAX Inbound <smaxinbound@gmail.com>
  0 siblings, 2 replies; 7+ messages in thread

From: SMAX Inbound @ 2021-06-05 17:14 UTC (permalink / raw)
  To: pgsql-admin@lists.postgresql.org

Hi All,

is there any script to automate pg_basebackup in linux using cron job..
i.e. shell script that will automate taking basebackup weekly, and removing
previous backup and wal files once base backup is successfully completed...


Thanks

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

* Re: Automate pg_basebackup in linux
@ 2021-06-05 17:44  Vijaykumar Jain <vijaykumarjain.github@gmail.com>
  parent: SMAX Inbound <smaxinbound@gmail.com>
  1 sibling, 1 reply; 7+ messages in thread

From: Vijaykumar Jain @ 2021-06-05 17:44 UTC (permalink / raw)
  To: SMAX Inbound <smaxinbound@gmail.com>; +Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>

you should write your own scripts imho.
I just github searched and found one .... but read and understand what it
does. how does it suit your db version etc.

etsin-harvester-ops/db_backup.sh at
0f6b9402ada16770894e7c63077c325cac1ed85f · CSCfi/etsin-harvester-ops
(github.com)
<https://github.com/CSCfi/etsin-harvester-ops/blob/0f6b9402ada16770894e7c63077c325cac1ed85f/ansible/r...;

you should also look into these as well. it might well be the next
requirement.
dhamaniasad/awesome-postgres: A curated list of awesome PostgreSQL
software, libraries, tools and resources, inspired by awesome-mysql
(github.com) <https://github.com/dhamaniasad/awesome-postgres#backups;


On Sat, 5 Jun 2021 at 22:45, SMAX Inbound <smaxinbound@gmail.com> wrote:

> Hi All,
>
> is there any script to automate pg_basebackup in linux using cron job..
> i.e. shell script that will automate taking basebackup weekly, and removing
> previous backup and wal files once base backup is successfully completed...
>
>
> Thanks
>
>

-- 
Thanks,
Vijay
Mumbai, India

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

* Re: Automate pg_basebackup in linux
@ 2021-06-05 18:40  Guillaume Lelarge <guillaume@lelarge.info>
  parent: Vijaykumar Jain <vijaykumarjain.github@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Guillaume Lelarge @ 2021-06-05 18:40 UTC (permalink / raw)
  To: Vijaykumar Jain <vijaykumarjain.github@gmail.com>; +Cc: SMAX Inbound <smaxinbound@gmail.com>; Pgsql-admin <pgsql-admin@lists.postgresql.org>

Le sam. 5 juin 2021 à 19:44, Vijaykumar Jain <
vijaykumarjain.github@gmail.com> a écrit :

> you should write your own scripts imho.
>

Actually, you shouldn't write your own. You should use an existing one,
such as barman or pgbackrest.

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

* Re: Automate pg_basebackup in linux
@ 2021-06-05 18:48  Ron <ronljohnsonjr@gmail.com>
  parent: SMAX Inbound <smaxinbound@gmail.com>
  1 sibling, 1 reply; 7+ messages in thread

From: Ron @ 2021-06-05 18:48 UTC (permalink / raw)
  To: pgsql-admin@lists.postgresql.org

On 6/5/21 12:14 PM, SMAX Inbound wrote:
>
> Hi All,
>
> is there any script to automate pg_basebackup in linux using cron job.. 
> i.e. shell script that will automate taking basebackup weekly, and 
> removing previous backup and wal files once base backup is successfully 
> completed...
>

If you know any shell scripting languages, such a script is easy to write.  
(Are you saying that you don't know "shell"?)

-- 
Angular momentum makes the world go 'round.

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

* Re: Automate pg_basebackup in linux
@ 2021-06-05 19:19  Karl Denninger <karl@denninger.net>
  parent: Guillaume Lelarge <guillaume@lelarge.info>
  0 siblings, 0 replies; 7+ messages in thread

From: Karl Denninger @ 2021-06-05 19:19 UTC (permalink / raw)
  To: pgsql-admin@lists.postgresql.org


On 6/5/2021 14:40, Guillaume Lelarge wrote:
> Le sam. 5 juin 2021 à 19:44, Vijaykumar Jain 
> <vijaykumarjain.github@gmail.com 
> <mailto:vijaykumarjain.github@gmail.com>> a écrit :
>
>     you should write your own scripts imho.
>
>
> Actually, you shouldn't write your own. You should use an existing 
> one, such as barman or pgbackrest.

pgbackrest is a lot more than just something that runs base backups.  
With that said I use and recommend it and its ability to do incremental 
copies as well as full backups, as well as being able to keep the copies 
either compressed (saves disk) or "ready to go" (can be started 
directly) is extremely useful, plus it can optimize transport as well.

-- 
Karl Denninger
karl@denninger.net <mailto:karl@denninger.net>
/The Market Ticker/
/[S/MIME encrypted email preferred]/

Attachments:

  smime.p7s (application/pkcs7-signature, 4.8K) download

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

* Re: Automate pg_basebackup in linux
@ 2021-06-07 15:56  Stephen Frost <sfrost@snowman.net>
  parent: Ron <ronljohnsonjr@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Stephen Frost @ 2021-06-07 15:56 UTC (permalink / raw)
  To: Ron <ronljohnsonjr@gmail.com>; +Cc: pgsql-admin@lists.postgresql.org

Greetings,

* Ron (ronljohnsonjr@gmail.com) wrote:
> On 6/5/21 12:14 PM, SMAX Inbound wrote:
> >is there any script to automate pg_basebackup in linux using cron job..
> >i.e. shell script that will automate taking basebackup weekly, and
> >removing previous backup and wal files once base backup is successfully
> >completed...
> >
> 
> If you know any shell scripting languages, such a script is easy to write. 
> (Are you saying that you don't know "shell"?)

Writing a script that actually does everything correct is actually
really hard, unfortunately.  I know, I tried (and using perl too, not
just unix shell...).  Leveraging pg_basebackup makes it a bit easier as
that'll do things like properly fsync'ing the files but it doesn't do
anything for really managing WAL.

Definitely strongly recommend using existing tools which have been
developed for PostgreSQL and which handle expiration of backups and WAL.

Thanks,

Stephen

Attachments:

  signature.asc (application/pgp-signature, 818B) download

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

* Re: Automate pg_basebackup in linux
@ 2021-06-07 17:11  Ron <ronljohnsonjr@gmail.com>
  parent: Stephen Frost <sfrost@snowman.net>
  0 siblings, 0 replies; 7+ messages in thread

From: Ron @ 2021-06-07 17:11 UTC (permalink / raw)
  To: pgsql-admin@lists.postgresql.org

On 6/7/21 10:56 AM, Stephen Frost wrote:
> Greetings,
>
> * Ron (ronljohnsonjr@gmail.com) wrote:
>> On 6/5/21 12:14 PM, SMAX Inbound wrote:
>>> is there any script to automate pg_basebackup in linux using cron job..
>>> i.e. shell script that will automate taking basebackup weekly, and
>>> removing previous backup and wal files once base backup is successfully
>>> completed...
>>>
>> If you know any shell scripting languages, such a script is easy to write.
>> (Are you saying that you don't know "shell"?)
> Writing a script that actually does everything correct is actually
> really hard, unfortunately.  I know, I tried (and using perl too, not
> just unix shell...).  Leveraging pg_basebackup makes it a bit easier as

That's what I meant: script to run pg_bb.


-- 
Angular momentum makes the world go 'round.





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


end of thread, other threads:[~2021-06-07 17:11 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-06-05 17:14 Automate pg_basebackup in linux SMAX Inbound <smaxinbound@gmail.com>
2021-06-05 17:44 ` Vijaykumar Jain <vijaykumarjain.github@gmail.com>
2021-06-05 18:40   ` Guillaume Lelarge <guillaume@lelarge.info>
2021-06-05 19:19     ` Karl Denninger <karl@denninger.net>
2021-06-05 18:48 ` Ron <ronljohnsonjr@gmail.com>
2021-06-07 15:56   ` Stephen Frost <sfrost@snowman.net>
2021-06-07 17:11     ` Ron <ronljohnsonjr@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