Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jXMUA-0001f3-OD for pgsql-general@arkaria.postgresql.org; Sat, 09 May 2020 10:13:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jXMU8-0007qa-T9 for pgsql-general@arkaria.postgresql.org; Sat, 09 May 2020 10:13:32 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jXMU8-0007qT-LI for pgsql-general@lists.postgresql.org; Sat, 09 May 2020 10:13:32 +0000 Received: from ns76.e-blokos.com ([51.79.78.76] helo=node76.e-blokos.com) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jXMU1-0002WP-JP for pgsql-general@lists.postgresql.org; Sat, 09 May 2020 10:13:31 +0000 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by node76.e-blokos.com (8.15.2/8.15.2) with ESMTP id 049ADLqi040065 for ; Sat, 9 May 2020 10:13:24 GMT Subject: Re: pg_basebackup cannot compress to STDOUNT To: "pgsql-generallists.postgresql.org" References: <22a6f05d-1bf3-1ea1-d32b-c44b08ed5767@aklaver.com> <70a49d18-c6cb-69e3-1ea8-ef09ebb5b579@e-blokos.com> From: Support Message-ID: Date: Sat, 9 May 2020 03:13:19 -0700 User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 5/8/2020 11:51 PM, Paul Förster wrote: > Hi Admin, > >> On 08. May, 2020, at 21:31, Support wrote: >> 2) Command run? >> ssh postgres@nodeXXX "pg_basebackup -h /run/postgresql -Ft -D- | pigz -c -p2 " | pigz -cd -p2 | tar -xf- -C /usr/local/pgsql/data > I don't get it, sorry. Do I understand you correctly here that you want an online backup or a *remotely* running PostgreSQL instance on your local machine? > > If so, why not just let pg_basebackup connect remotely and let it do its magic? Something like this: > > $ mkdir -p /usr/local/pgsql/data > $ cd /usr/local/pgsql/data > $ pg_basebackup -D /run/postgresql -Fp -P -v -h nodeXXX -p 5432 -U replicator > $ pg_ctl start > > You'd have to have a role with replication privs or superuser and you'd have to adapt the port of course. > > No need to take care of any WALs manually. It is all taken care of by pg_basebackup. The only real drawback is that if you have tablespaces, you'd have to create all directories of the tablespaces beforehand, which is why we removed them again after initially having tried the feature. > > That's basically, how I create async replicas on out site, which is why I additionally add -R to the above command. > > Cheers, > Paul > The trick of my command above is to get the transfer faster in one compressed file going through the network.