Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id A5B9813382CF for ; Thu, 14 Oct 2010 06:37:55 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 36796-04-2 for ; Thu, 14 Oct 2010 09:37:47 +0000 (UTC) Received: from mx3.hub.org (mx3.hub.org [206.223.169.73]) by mail.postgresql.org (Postfix) with ESMTP id EA77F1337C83 for ; Thu, 14 Oct 2010 03:20:03 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.postnewspapers.com.au (202-89-185-120.static.dsl.amnet.net.au [202.89.185.120]) by mx3.hub.org (Postfix) with ESMTP id 995ED37BC3B for ; Thu, 14 Oct 2010 03:12:19 -0300 (ADT) Received: from [10.0.0.53] (wallace.localnet [10.0.0.53]) by mail.postnewspapers.com.au (Postfix) with ESMTP id 60CD1AE373; Thu, 14 Oct 2010 11:41:55 +0800 (WST) Message-ID: <4CB67C03.2010300@postnewspapers.com.au> Date: Thu, 14 Oct 2010 11:41:55 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4 MIME-Version: 1.0 To: "Evan D. Hoffman" CC: Brian Hirt , Postgresql Mailing List Subject: Re: Copying data files to new hardware? References: <7dc101b1-6596-4850-b0ce-cb3f01f51f14@n40g2000vbb.googlegroups.com> In-Reply-To: X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201010/492 X-Sequence-Number: 168404 On 14/10/10 00:59, Evan D. Hoffman wrote: > Thanks, Brian & Jaime. Regarding Slony, would that allow for > migration to a new version as well - i.e. moving from 8.2 on the old > machine to 8.4 on the new machine via Slony with minimal downtime? > > The Slony method is one I hadn't considered. Since our database is so > large, even a direct file copy would require some downtime (since we'd > need to stop the DB before beginning the copy). You don't have to stop the DB before doing a file-level database copy, though. If you set up WAL archiving to the destination server, you can then use pg_start_backup(), copy the data directory while Pg is writing to it, disconnect clients, pg_stop_backup(), and only then shut the old Pg down. You will face some WAL replay time bringing the new machine up, though if you set it up as a warm spare with continuous replay that'll minimize the replay time. Unless your master is under heavy continuous write load it won't be too bad anyway. The handy thing about this approach is that you can *test* it by doing the whole migration as if you meant it for real, just not disconnecting clients from the original server or shutting it down at the end. That gives you a chance to verify that the DB that's been replicated to the new server has come up cleanly and is working well before you do the whole thing again for real. Even better, if you've done such a test you can use rsync to update your base backup after pg_start_backup() instead of copying the whole thing again, which can be a *LOT* faster. If you take this approach, be VERY sure to read the documentation on PITR and warm standby, and test your migration before doing it for real. -- Craig Ringer Tech-related writing: http://soapyfrogs.blogspot.com/