Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iw2U5-0002ed-6C for pgsql-general@arkaria.postgresql.org; Mon, 27 Jan 2020 11:23:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iw2U3-0007PC-VX for pgsql-general@arkaria.postgresql.org; Mon, 27 Jan 2020 11:23:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iw2U3-0007P5-Jg for pgsql-general@lists.postgresql.org; Mon, 27 Jan 2020 11:23:11 +0000 Received: from mail-oi1-x242.google.com ([2607:f8b0:4864:20::242]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iw2Tz-0004Tl-Io for pgsql-general@lists.postgresql.org; Mon, 27 Jan 2020 11:23:10 +0000 Received: by mail-oi1-x242.google.com with SMTP id z64so6297290oia.4 for ; Mon, 27 Jan 2020 03:23:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=xDwJhGZXSoIbhP7ysHrKBqsrxAEHDGrSFZi2kbc3hbY=; b=pLj/ODbxs715iHCtfHDiVqAZai05XmgS188X0AHxmayzP2ospSrb7sW5luSFKuagzl Bt1yBiKFT2mK2XoAYTXAPB2mUNbSRatkOCUtNzxPrEClhU0/UhbMJxKYq/V7E/YXimOD qfYaYMZ2b6QB5a8oCjzAsjlcES2lCb66NxIKKXHreIDKo6RxkfAzATAJsCHrJtMVpOkf nEdj0beuHkU9nY5UFWd1gJFYlPE1RGZOA9pmzlp/l90+OVdQzTjPUaaKr9CPtZWaQaoV gBWHInNHXY0crAAf42NlciM8BPbHpiKfr4nfiiQB3UCA3fRs0rtMg77ry2Lv2Owg64vk Y2eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=xDwJhGZXSoIbhP7ysHrKBqsrxAEHDGrSFZi2kbc3hbY=; b=KjvDk90WzTIF6wCJsx63Va/dd2XBbnxzxEfsb+bj1sAPcO0QH+p9CGakPzVk5mdw7C TLOyDx0obon7q2s7E3sJOPJclWul89U6lpPi/llTc8P54VRVtaWT05KHM6c4E6kI0KaD GVY4a2o4YrmBjWE1CafJOfYvn9VpShli96Msz8JRjXHav4qm5flOSEAfBBPjCbO6hgDr 7GZqN/Thk1O1maaY6c43JxQpy7a7fc64Uo303MVBnsvV2bIqmaYCndFpnJqWjS6wqsXk KiVUqtp58R3kiTE2tF9qie4qkGMYDXC7L4brLqplHtnUfDlhPejxsCbiPoXOsMRgW1j+ pUFg== X-Gm-Message-State: APjAAAVGJ8abRsIUOCWRmPuXTHWaCHFm1BdLmwvWCGWl2SxA7I6gAl7r uEAwsy/p1qZID6lQbs2mZ1oIZoRHKHQ= X-Google-Smtp-Source: APXvYqyboyYrXDjRwtuEWCEQW4Cl5Ps18AJcOMSCziOMD00HLhU5eafAxeNqLqqhBeHITyDBr2kR7A== X-Received: by 2002:a05:6808:4c2:: with SMTP id a2mr6787129oie.118.1580124185493; Mon, 27 Jan 2020 03:23:05 -0800 (PST) Received: from [192.168.1.10] (ip70-186-126-197.no.no.cox.net. [70.186.126.197]) by smtp.googlemail.com with ESMTPSA id r205sm4741068oih.54.2020.01.27.03.23.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Jan 2020 03:23:05 -0800 (PST) Subject: Re: How to transfer databases form one server to other To: pgsql-general@lists.postgresql.org References: From: Ron Message-ID: <64a5d084-9e90-738f-3fe3-f0d859312bf1@gmail.com> Date: Mon, 27 Jan 2020 05:23:04 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------788F97631785FD24494D9CF8" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------788F97631785FD24494D9CF8 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 1/26/20 10:44 PM, Andreas Joseph Krogh wrote: > På mandag 27. januar 2020 kl. 03:26:59, skrev Ron >: > > [..] > I ran *uncompressed* pg_dump on multiple TB+ sized databases from v8.4 > servers across the LAN using 9.6 binaries on the remote server.  It > was quite fast.  Threading was key. > > According to the manual: https://www.postgresql.org/docs/12/app-pgdump.html > the "directory format" is the only format which supports parallel dumps, > if I'm not reading it wrong. > How did threading solve "between database" dump/restore for you? Did you > dump to "directory format" first, then restore? Yes. > If so, then that requires quite a bit of temp-space... Correct. The databases are mostly compressed TIFF and PDF images in bytea fields, so having Postgres try and compress them again was *slow* and used a *lot* of CPU.  Thus, I did uncompressed backups, and that took a *lot* of scratch disk space. (We were not only upgrading Postgres 8.4 to 9.6, but also RHEL 5.10 to 6.10, and moving to a geographically distant data center.  Thus, I deemed pg_upgrade to be impractical.) We spun up some VMs with 10 total TB in the same DC as the source (physical) servers, and I installed Pg 9.6 on these "intermediate servers", and did remote pg_dumps of the 8.4 servers.  Then I installed 9.6 on the VMs in the new DC, and NFS mounted the intermediate servers' volumes and ran multi-threaded pg_restore on the new servers.  They pulled the data across the WAN. -- Angular momentum makes the world go 'round. --------------788F97631785FD24494D9CF8 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit On 1/26/20 10:44 PM, Andreas Joseph Krogh wrote:
På mandag 27. januar 2020 kl. 03:26:59, skrev Ron <ronljohnsonjr@gmail.com>:
[..]
I ran uncompressed pg_dump on multiple TB+ sized databases from v8.4 servers across the LAN using 9.6 binaries on the remote server.  It was quite fast.  Threading was key.
 
the "directory format" is the only format which supports parallel dumps, if I'm not reading it wrong.
 
How did threading solve "between database" dump/restore for you? Did you dump to "directory format" first, then restore?

Yes.

If so, then that requires quite a bit of temp-space...

Correct. The databases are mostly compressed TIFF and PDF images in bytea fields, so having Postgres try and compress them again was slow and used a lot of CPU.  Thus, I did uncompressed backups, and that took a lot of scratch disk space.

(We were not only upgrading Postgres 8.4 to 9.6, but also RHEL 5.10 to 6.10, and moving to a geographically distant data center.  Thus, I deemed pg_upgrade to be impractical.)

We spun up some VMs with 10 total TB in the same DC as the source (physical) servers, and I installed Pg 9.6 on these "intermediate servers", and did remote pg_dumps of the 8.4 servers.  Then I installed 9.6 on the VMs in the new DC, and NFS mounted the intermediate servers' volumes and ran multi-threaded pg_restore on the new servers.  They pulled the data across the WAN.

--
Angular momentum makes the world go 'round.
--------------788F97631785FD24494D9CF8--