Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id E91D31E62E85 for ; Wed, 25 Apr 2012 13:33:05 -0300 (ADT) Received: from mx2.d2.com ([66.251.81.121]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SN59I-0001ie-MB for pgsql-admin@postgresql.org; Wed, 25 Apr 2012 16:33:04 +0000 Received: from mxb.d2.com ([10.85.4.6]) by mx2.d2.com (8.13.8/8.13.8) with ESMTP id q3PHTCMj010580 for ; Wed, 25 Apr 2012 10:29:12 -0700 X-ASG-Debug-ID: 1335371558-01d10a6c99bc3310001-ysJW5H Received: from mail01.d2.com ([172.16.66.171]) by mxb.d2.com with ESMTP id WKBErbtImVTCNsZC for ; Wed, 25 Apr 2012 09:32:38 -0700 (PDT) X-Barracuda-Envelope-From: aalvarez@d2.com Received: from exbew2k3-02.d2.com (exbew2k3-02 [10.78.2.16]) by mail01.d2.com (8.13.8/8.13.8/Debian-3) with ESMTP id q3PGWc5U017364 for ; Wed, 25 Apr 2012 09:32:38 -0700 Received: from [10.126.2.222] ([10.126.2.222] RDNS failed) by exbew2k3-02.d2.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 25 Apr 2012 09:32:37 -0700 Message-ID: <4F982725.103@d2.com> Date: Wed, 25 Apr 2012 09:32:37 -0700 From: amador alvarez User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.2.27) Gecko/20120216 Lightning/1.0b2 Thunderbird/3.1.19 MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: Re: Backup/disaster recovery and bandwidth (long) References: X-ASG-Orig-Subj: Re: [ADMIN] Backup/disaster recovery and bandwidth (long) In-Reply-To: Content-Type: multipart/alternative; boundary="------------090506070407040001060809" X-OriginalArrivalTime: 25 Apr 2012 16:32:37.0929 (UTC) FILETIME=[06C78190:01CD2301] X-Barracuda-Connect: UNKNOWN[172.16.66.171] X-Barracuda-Start-Time: 1335371558 X-Barracuda-URL: http://10.85.4.6:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at d2.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests=BSF_SC1_TG070, HTML_MESSAGE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.95137 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 HTML_MESSAGE BODY: HTML included in message 0.50 BSF_SC1_TG070 Custom Rule TG070 X-Spam-Status: NO, score=-2.5 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, HTML_MESSAGE, HTML_TITLE_EMPTY, RATWARE_GECKO_BUILD autolearn=ham version=3.2.4 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on mx2.d2.com X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201204/131 X-Sequence-Number: 39467 This is a multi-part message in MIME format. --------------090506070407040001060809 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Scott, Why you do not replicate this master to the other location/s using other methods like bucardo?, you can pick the tables you really want get replicated there. For the backup turn to hot backup (tar $PGDATA)+ archiving, easier, faster and more efficient rather than a logical copy with pgdump. A.A On 04/25/2012 09:11 AM, Scott Whitney wrote: > Hello, everyone. I want to throw a scenario out there to see what > y'all think. > > Soon, my cluster backups will be increasing in size inordinately. > They're going to immediately go to 3x as large as they currently are > with the potential to be about 20x within a year or so. > > My current setup uses a single PG 8.x server doing nightly dumps (not > ideal but sufficient for the moment, and one of the main reasons to > move to PG 9) which are then downloaded from my hosting center to our > offices for DR purposes. Each night I pull down roughly 5GB of > compressed pg_dump data. Dumping this takes about 1.5hrs. Downloading > this at 15Mbps takes about an hour. Soon I'll be looking at somewhere > around 7hrs for the dumps to complete and downloading a 12GB file > (which will take about 3 hrs). Oh, and I'll have to pay for > significant bandwidth overage since I'm charged on a 95%, and while an > hour a day does NOT kick me up to 15Mbps usage at 95%, 3hrs per night > certainly will, so there's a real cost associated with this strategy > as well. > > While the time of the actual dumps is not a huge issue, the time of > the download IS a large concern, especially since my support folks use > that file daily to extract individual customer databases for restore > in assisting customer support issues. > > So, while now I have my pg_dumps completed around 2AM and downloaded > to my local network at about 3AM, with the increase in our database > sizes, what will be happening is that my pg_dump will not be completed > until around 7AM, and the download would not be completed until around > 10AM, best-case scenario. Add into that support trying to restore a > database...more on that in a moment. > > My _new_ setup will instead be 2 PG 9.x servers with hot-standby > enabled (at my hosting center) and a 3rd PG 9.x server at my local > office also replicating off of the master. Each one of those servers > will perform his own pg_dumps of the individual databases for > backup/disaster recovery purposes, and while each dump might not be > consistent with one another, each SERVER will have dumps consistent to > itself, which is viable for our situation, and does not require me to > download 12GB (or more) each night with all of those associated > nightmares, costs and other problems. > > Alright, well, I've got that part all thought out, and it seems like a > good way to do it to me, but I'm _still_ running into the situation > that I've got to take 8hrs-ish to run the pg_dump no matter where it > runs, and when my support folks need it (which they do daily), this > basically means that if they have to have a customer database up NOW > NOW NOW for support reasons, they simply cannot have it within an hour > in many cases. Specifically, one database takes between 2 and 7.5hrs > to pg_dump depending on which format I use, so if they need a CURRENT > copy, they're at least 4 hours out. Additionally, they can't directly > use the replicating server at my local office, because they need to > test the problems the customers are having which include pesky things > like INSERT, UPDATE and DELETE, so they have to restore this data to > another internal PG backend. > > Enter my outside-the-box thinking. > > I rather assume that you cannot do a start/stop backup on a > hot-standby server. HOWEVER, what if.... > > I set up a 4th database server internally at my office. Each night I > stop PG on my 3rd server (the local one replicating off of the master) > and rsync my pg_data directory to this new 4th server. I bring up the > 4th server NOT as a standby, but as a master. They would then have all > customer data on an internal, usable PG system from the time of the > rsync, and while it might not reflect the immediate state of the > database, that's pretty well always true, and they're used to that, > since whenever they "clone" a site, they're using the dumps done > around midnight anyway. > > I believe, then, that when I restart server #3 (the standby who is > replicating), he'll say "oh, geez, I was down, let me catch up on all > that crap that happened while I was out of the loop," he'll replay the > WAL files that were written while he was down, and then he'll catch > back up. > > Does this sound like a viable option? Or does someone have additional > suggestions? --------------090506070407040001060809 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi Scott,
Why you do not replicate this master to the other location/s using other methods like bucardo?, you can pick the tables you really want get replicated there.
For the backup turn to hot backup (tar $PGDATA)+ archiving, easier, faster and more efficient rather than a logical copy with pgdump.

A.A

On 04/25/2012 09:11 AM, Scott Whitney wrote:
Hello, everyone. I want to throw a scenario out there to see what y'all think.

Soon, my cluster backups will be increasing in size inordinately. They're going to immediately go to 3x as large as they currently are with the potential to be about 20x within a year or so.

My current setup uses a single PG 8.x server doing nightly dumps (not ideal but sufficient for the moment, and one of the main reasons to move to PG 9) which are then downloaded from my hosting center to our offices for DR purposes. Each night I pull down roughly 5GB of compressed pg_dump data. Dumping this takes about 1.5hrs. Downloading this at 15Mbps takes about an hour. Soon I'll be looking at somewhere around 7hrs for the dumps to complete and downloading a 12GB file (which will take about 3 hrs). Oh, and I'll have to pay for significant bandwidth overage since I'm charged on a 95%, and while an hour a day does NOT kick me up to 15Mbps usage at 95%, 3hrs per night certainly will, so there's a real cost associated with this strategy as well.

While the time of the actual dumps is not a huge issue, the time of the download IS a large concern, especially since my support folks use that file daily to extract individual customer databases for restore in assisting customer support issues.

So, while now I have my pg_dumps completed around 2AM and downloaded to my local network at about 3AM, with the increase in our database sizes, what will be happening is that my pg_dump will not be completed until around 7AM, and the download would not be completed until around 10AM, best-case scenario. Add into that support trying to restore a database...more on that in a moment.

My _new_ setup will instead be 2 PG 9.x servers with hot-standby enabled (at my hosting center) and a 3rd PG 9.x server at my local office also replicating off of the master. Each one of those servers will perform his own pg_dumps of the individual databases for backup/disaster recovery purposes, and while each dump might not be consistent with one another, each SERVER will have dumps consistent to itself, which is viable for our situation, and does not require me to download 12GB (or more) each night with all of those associated nightmares, costs and other problems.

Alright, well, I've got that part all thought out, and it seems like a good way to do it to me, but I'm _still_ running into the situation that I've got to take 8hrs-ish to run the pg_dump no matter where it runs, and when my support folks need it (which they do daily), this basically means that if they have to have a customer database up NOW NOW NOW for support reasons, they simply cannot have it within an hour in many cases. Specifically, one database takes between 2 and 7.5hrs to pg_dump depending on which format I use, so if they need a CURRENT copy, they're at least 4 hours out. Additionally, they can't directly use the replicating server at my local office, because they need to test the problems the customers are having which include pesky things like INSERT, UPDATE and DELETE, so they have to restore this data to another internal PG backend.

Enter my outside-the-box thinking.

I rather assume that you cannot do a start/stop backup on a hot-standby server. HOWEVER, what if....

I set up a 4th database server internally at my office. Each night I stop PG on my 3rd server (the local one replicating off of the master) and rsync my pg_data directory to this new 4th server. I bring up the 4th server NOT as a standby, but as a master. They would then have all customer data on an internal, usable PG system from the time of the rsync, and while it might not reflect the immediate state of the database, that's pretty well always true, and they're used to that, since whenever they "clone" a site, they're using the dumps done around midnight anyway.

I believe, then, that when I restart server #3 (the standby who is replicating), he'll say "oh, geez, I was down, let me catch up on all that crap that happened while I was out of the loop," he'll replay the WAL files that were written while he was down, and then he'll catch back up.

Does this sound like a viable option? Or does someone have additional suggestions?
--------------090506070407040001060809--