Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g5re3-0002Tj-M6 for pgsql-general@arkaria.postgresql.org; Fri, 28 Sep 2018 12:13:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g5re1-0007zJ-Gj for pgsql-general@arkaria.postgresql.org; Fri, 28 Sep 2018 12:13:17 +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_SHA384:256) (Exim 4.89) (envelope-from ) id 1g5rdz-0007hi-1s for pgsql-general@lists.postgresql.org; Fri, 28 Sep 2018 12:13:15 +0000 Received: from hermes.gatewaynet.com ([193.92.121.98]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1g5rdu-000402-Ti for pgsql-general@lists.postgresql.org; Fri, 28 Sep 2018 12:13:13 +0000 Received: from smadev.internal.net (pc131.internal.net [10.9.200.131]) by hermes.gatewaynet.com (8.14.3/8.14.3/Debian-9.4) with ESMTP id w8SCD2OX006327 for ; Fri, 28 Sep 2018 15:13:07 +0300 Received: from smadev.internal.net (smadev [10.9.200.131]) by smadev.internal.net (8.15.2/8.15.2) with ESMTP id w8SCD21w021746 for ; Fri, 28 Sep 2018 15:13:02 +0300 (EEST) (envelope-from achill@matrix.gatewaynet.com) Subject: Re: Replication Issues To: pgsql-general@lists.postgresql.org References: From: Achilleas Mantzios Message-ID: Date: Fri, 28 Sep 2018 15:13:02 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.0.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------3EE28632307E1EDD64F39ED4" Content-Language: en-US X-Virus-Scanned: clamav-milter 0.98.7 at hermes X-Virus-Status: Clean X-Spam-Status: No, score=-28.0 required=5.0 tests=ALL_TRUSTED,DYN_HAM_COORD, DYN_HAM_IT,DYN_HAM_NAUTICAL,HTML_MESSAGE autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on hermes.gatewaynet.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------3EE28632307E1EDD64F39ED4 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 28/9/18 1:50 μ.μ., bhargav kamineni wrote: > Ee are using 9.5 version, slot option -s is not available ,can I go with -X stream option ? -S is intended when you plan to use the backup as a hot standby, when you must use the same replication slot. If you plan to use the backup as a stand alone backup you don't need this option anyway. > > On Fri 28 Sep, 2018, 12:01 PM Laurenz Albe, > wrote: > >  bhargav kamineni wrote: > > Hi Team, > > > > I have configured replication using slot ,But it failed by throwing the > > ERROR  pg_basebackup: could not get transaction log end position from server: > > ERROR:  requested WAL segment 0000000100002C9D00000085 has already been removed , > > which is  unexpected because i have created the slot on master first > > and then issued the base backup command from slave's end > > the command is > > usr/lib/postgresql/9.5/bin/pg_basebackup -U  user --max-rate='150 M' --progress --verbose --write-recovery-conf --status-interval='10 s' -D data_dir  -h host_ip  -p 5433 > > These  are the settings on my master > > archive_mode=on > > archive_command='/bin/true' > > wal_keep_segments=512 > > max_wal_senders=4 > > Series of steps i have followed : > > 1) Enabled password less authentication between master and slave > > 2)created slot on master (assuming it will store wal's regardless of other settings) > > 3)started basebackup from slave's end > > 4)Issued checkpoint at master's end > > > > Here my concern is , slave should recover WAL from replication slot but why i > > got the above ERROR , Why slot removed  the requested wal file , Could you please > > let me know the reason why it happened or did i miss something ? > > I guess your base backup took long enough for the required WAL segments to be > removed by the time it was done. > > To prevent that, create a replication slot *before* you perform pg_basebackup > and use the options "-S -X stream" of pg_basebackup. > > You then use the same slot in "recovery.conf". > > That way you cannot lose any WAL. > > Yours, > Laurenz Albe > -- > Cybertec | https://www.cybertec-postgresql.com > -- Achilleas Mantzios IT DEV Lead IT DEPT Dynacom Tankers Mgmt --------------3EE28632307E1EDD64F39ED4 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
On 28/9/18 1:50 μ.μ., bhargav kamineni wrote:
Ee are using 9.5 version, slot option -s is not available ,can I go with -X stream option ?
-S is intended when you plan to use the backup as a hot standby, when you must use the same replication slot.
If you plan to use the backup as a stand alone backup you don't need this option anyway.

On Fri 28 Sep, 2018, 12:01 PM Laurenz Albe, <laurenz.albe@cybertec.at> wrote:
 bhargav kamineni wrote:
> Hi Team,
>
> I have configured replication using slot ,But it failed by throwing the
> ERROR  pg_basebackup: could not get transaction log end position from server:
> ERROR:  requested WAL segment 0000000100002C9D00000085 has already been removed ,
> which is  unexpected because i have created the slot on master first
> and then issued the base backup command from slave's end
> the command is
> usr/lib/postgresql/9.5/bin/pg_basebackup -U  user --max-rate='150 M' --progress --verbose --write-recovery-conf --status-interval='10 s' -D data_dir  -h host_ip  -p 5433
> These  are the settings on my master
> archive_mode=on
> archive_command='/bin/true'
> wal_keep_segments=512
> max_wal_senders=4
> Series of steps i have followed :
> 1) Enabled password less authentication between master and slave
> 2)created slot on master (assuming it will store wal's regardless of other settings)
> 3)started basebackup from slave's end
> 4)Issued checkpoint at master's end
>
> Here my concern is , slave should recover WAL from replication slot but why i
> got the above ERROR , Why slot removed  the requested wal file , Could you please
> let me know the reason why it happened or did i miss something ?

I guess your base backup took long enough for the required WAL segments to be
removed by the time it was done.

To prevent that, create a replication slot *before* you perform pg_basebackup
and use the options "-S <slotname> -X stream" of pg_basebackup.

You then use the same slot in "recovery.conf".

That way you cannot lose any WAL.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com



-- 
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt
--------------3EE28632307E1EDD64F39ED4--