Обсуждение: backup and archive postgresql data older than 6 months

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

backup and archive postgresql data older than 6 months

От
Kaushal Shriyan
Дата:
Hi,

Are there scripts which takes backup of postgresql database and archive data older than 6 months and push it to a remote server using scp or rsync method and purge/clean the local data on the hard disk at the same time meaning at any given time we have only six months of postgresql data on the postgresql database server.

Any help will be highly appreciable.

Regards,

Kaushal

Re: backup and archive postgresql data older than 6 months

От
Ian Barwick
Дата:
On 15/08/26 19:46, Kaushal Shriyan wrote:
> Hi,
>
> Are there scripts which takes backup of postgresql database and archive data
> older than 6 months and push it to a remote server using scp or rsync method
> and purge/clean the local data on the hard disk at the same time meaning at
> any given time we have only six months of postgresql data on the postgresql
> database server.

Have you looked at Barman ( http://www.pgbarman.org/ )?


Regards

Ian Barwick

--
 Ian Barwick                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, RemoteDBA, Training & Services


Re: backup and archive postgresql data older than 6 months

От
Vincent Veyron
Дата:
On Wed, 26 Aug 2015 10:46:53 +0000
Kaushal Shriyan <kaushalshriyan@gmail.com> wrote:

> Hi,
>
> Are there scripts which takes backup of postgresql database and archive
> data older than 6 months and push it to a remote server using scp or rsync
> method and purge/clean the local data on the hard disk at the same time
> meaning at any given time we have only six months of postgresql data on the
> postgresql database server.

What system are you on?

On linux, you can use log_rotate to rotate your backups; just add a file to /etc/logrotate.d. Here is what I use to
keepa weekly backup over one year: 

/var/backups/marica/marica.gz {
    weekly
    missingok
    rotate 52
    notifempty
}

And here is a naive bash script to send a dump file to a remote server; it's launched by cron:

http://pastebin.com/Xg4wXdjy



--
                    Salutations, Vincent Veyron

https://legalcase.libremen.com/
Legal case, contract and insurance claim management software


Re: backup and archive postgresql data older than 6 months

От
Adrian Klaver
Дата:
On 08/26/2015 03:46 AM, Kaushal Shriyan wrote:
> Hi,
>
> Are there scripts which takes backup of postgresql database and archive
> data older than 6 months and push it to a remote server using scp or
> rsync method and purge/clean the local data on the hard disk at the same
> time meaning at any given time we have only six months of postgresql
> data on the postgresql database server.

Not entirely sure what you want here?:

1) Do you want to keep a set of backups that end no less then 6 months ago

or

2) Do you want the actual data in the server to be no more then 6 months
old with older data pulled out and archived.

If 2)

A) How do you propose determining the age of a record ?

B) How do you deal with FK relationships and missing data?

>
> Any help will be highly appreciable.
>
> Regards,
>
> Kaushal


--
Adrian Klaver
adrian.klaver@aklaver.com