Обсуждение: Automate pg_basebackup in linux

Поиск
Список
Период
Сортировка

Automate pg_basebackup in linux

От
SMAX Inbound
Дата:

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


Re: Automate pg_basebackup in linux

От
Vijaykumar Jain
Дата:
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.


you should also look into these as well. it might well be the next requirement.


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

Re: Automate pg_basebackup in linux

От
Guillaume Lelarge
Дата:
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.

Re: Automate pg_basebackup in linux

От
Ron
Дата:
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.

Re: Automate pg_basebackup in linux

От
Karl Denninger
Дата:


On 6/5/2021 14:40, Guillaume Lelarge wrote:
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.

--
Karl Denninger
karl@denninger.net
The Market Ticker
[S/MIME encrypted email preferred]
Вложения

Re: Automate pg_basebackup in linux

От
Stephen Frost
Дата:
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

Вложения

Re: Automate pg_basebackup in linux

От
Ron
Дата:
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.