Обсуждение: Automate pg_basebackup in linux
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
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
you should write your own scripts imho.
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.
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.
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.
Вложения
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
Вложения
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.