Re: backup and archive postgresql data older than 6 months

From: Vincent Veyron <vv(dot)lists(at)wanadoo(dot)fr>
To: Kaushal Shriyan <kaushalshriyan(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: backup and archive postgresql data older than 6 months
Date: 2015-08-26 12:55:51
Message-ID: 20150826145551.dd71981cdc37982060f756a2@wanadoo.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 26 Aug 2015 10:46:53 +0000
Kaushal Shriyan <kaushalshriyan(at)gmail(dot)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 keep a 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John Turner 2015-08-26 13:04:08 Re: PostgreSQL Developer Best Practices
Previous Message Condor 2015-08-26 12:23:55 Re: PostgreSQL Developer Best Practices