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 1gUAHu-0004xK-L0 for pgsql-admin@arkaria.postgresql.org; Tue, 04 Dec 2018 12:58:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gUAHs-0001mY-UI for pgsql-admin@arkaria.postgresql.org; Tue, 04 Dec 2018 12:58:52 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gUAHs-0001mQ-E4 for pgsql-admin@lists.postgresql.org; Tue, 04 Dec 2018 12:58:52 +0000 Received: from hermes.gatewaynet.com ([193.92.121.98]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gUAHn-0006gE-F1 for pgsql-admin@lists.postgresql.org; Tue, 04 Dec 2018 12:58:51 +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 wB4CwbTe032217 for ; Tue, 4 Dec 2018 14:58:42 +0200 Received: from smadev.internal.net (smadev [10.9.200.131]) by smadev.internal.net (8.15.2/8.15.2) with ESMTP id wB4Cwb5N056504 for ; Tue, 4 Dec 2018 14:58:37 +0200 (EET) (envelope-from achill@matrix.gatewaynet.com) Subject: Re: pg_basebackup fails: could not receive data from WAL stream: server closed the connection unexpectedly To: pgsql-admin@lists.postgresql.org References: From: Achilleas Mantzios Message-ID: Date: Tue, 4 Dec 2018 14:58:37 +0200 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="------------AEA7F847BB3D2C980E5AB0A6" Content-Language: en-US X-Virus-Scanned: clamav-milter 0.98.7 at hermes X-Virus-Status: Clean X-Spam-Status: No, score=-36.9 required=5.0 tests=ALL_TRUSTED,DYN_HAM_COORD, DYN_HAM_IT,DYN_HAM_IT_PARTNERS,DYN_HAM_NAUTICAL,DYN_HAM_SIGNAT1,HTML_MESSAGE, TW_PG 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. --------------AEA7F847BB3D2C980E5AB0A6 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 4/12/18 2:48 μ.μ., AYahorau@ibagroup.eu wrote: > Hi, > Thank you very much for the response. > > I reckon we can return to more conventional approach of postgres db synchronization: > 1) SELECT pg_start_backup('label', true); > 2) rsync/cp  $PGDATA directory; > 3) SELECT pg_stop_backup(); > > In my opinion this approach looks better because it does not depend on wal_sender_timeout value. > But it depends on wal archiving to a safe location. Do you have this enabled, working and tested? > I have a question. What is your opinion about *pg_basebackup *utility and its behaviour for this condition?  Is it a bug? Should it be fixed? > > Best regards, > Andrei > > > > From: Shreeyansh Dba > To: AYahorau@ibagroup.eu, > Cc: pgsql-admin , MikalaiKeida@ibagroup.eu > Date: 03/12/2018 15:15 > Subject: Re: pg_basebackup fails: could not receive data from WAL stream: server closed the connection unexpectedly > -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > > > > Hi Andrei Yahorau, > > As it is difficult to give an exact recommendation, however, We have enabled and tested your exact error with the same parameters in our testing environment, we received the same error and able to > resolve this problem by increasing 'wal_sender_timeout' parameter value. > > I think you need to test and verify before implementing it on your server according to your business, configuration requirements. > > > > > On Mon, Dec 3, 2018 at 2:17 PM <_AYahorau@ibagroup.eu_ > wrote: > Hello PostgreSQL Community! > > > Not so long ago I faced the problem of database synchronization using pg_basebackup utility on linux SLES 12 machine using PostgreSQL 10.4: > > pg_basebackup -h host01 -U dbuser  -D /var/PostgresDb   -w/ > LOG:  standby //"pg_basebackup"//is now a synchronous standby with priority 1 > pg_basebackup: could not receive data from WAL stream: server closed the connection unexpectedly >                 This probably means the server terminated abnormally >                 before or //while//processing the request. > pg_basebackup: child process exited with error 1 > pg_basebackup: removing contents of data directory //"/var/RtpPostgresDb"/ > > > PostgreSQL log of master server contain the following error entry:/ > terminating walsender process due to replication timeout/ > > Currently my configuration is the following: > wal_sender_timeout = 1s > wal_receiver_timeout = 1s > wal_receiver_status_interval = 10s > > I see that some people faced this situation:_ > __https://www.postgresql.org/message-id/109968546.289.1460409481048.JavaMail.pbrunnen%40Station8.local_ > The suggestion was increasing *wal_sender_timeout *parameter. > > On the one hand I understand that  if my database gets bigger it will require bigger value of *wal_sender_timeout*. On the other hand I use *wal_sender_timeout = 1s* on purpose in  order to detect > if network bad. > > Could you please suggest an appropriate configuration, sensible relations between configuration parameters or any other approach of database synchronization which overcomes this issue? > > Thank you in advance, > Andrei Yahorau -- Achilleas Mantzios IT DEV Lead IT DEPT Dynacom Tankers Mgmt --------------AEA7F847BB3D2C980E5AB0A6 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
On 4/12/18 2:48 μ.μ., AYahorau@ibagroup.eu wrote:
Hi,
Thank you very much for the response.

I reckon we can return to more conventional approach of postgres db synchronization:
1) SELECT pg_start_backup('label', true);
2) rsync/cp  $PGDATA directory;
3) SELECT pg_stop_backup();


In my opinion this approach looks better because it does not depend on wal_sender_timeout value.


But it depends on wal archiving to a safe location. Do you have this enabled, working and tested?

I have a question. What is your opinion about pg_basebackup utility and its behaviour for this condition?  Is it a bug? Should it be fixed?

Best regards,
Andrei



From:        Shreeyansh Dba <shreeyansh2014@gmail.com>
To:        AYahorau@ibagroup.eu,
Cc:        pgsql-admin <pgsql-admin@postgresql.org>, MikalaiKeida@ibagroup.eu
Date:        03/12/2018 15:15
Subject:        Re: pg_basebackup fails: could not receive data from WAL stream: server closed the connection unexpectedly




Hi Andrei Yahorau,

As it is difficult to give an exact recommendation, however, We have enabled and tested your exact error with the same parameters in our testing environment, we received the same error and able to resolve this problem by increasing 'wal_sender_timeout' parameter value.

I think you need to test and verify before implementing it on your server according to your business, configuration requirements.




On Mon, Dec 3, 2018 at 2:17 PM <AYahorau@ibagroup.eu> wrote:
Hello PostgreSQL Community!


Not so long ago I faced the problem of database synchronization using pg_basebackup utility on linux SLES 12 machine using PostgreSQL 10.4:


pg_basebackup -h host01 -U dbuser  -D /var/PostgresDb   -w

LOG:  standby
"pg_basebackup" is now a synchronous standby with priority 1
pg_basebackup: could not receive data from WAL stream: server closed the connection unexpectedly
                This probably means the server terminated abnormally
                before or
while processing the request.
pg_basebackup: child process exited with error 1
pg_basebackup: removing contents of data directory
"/var/RtpPostgresDb"


PostgreSQL log of master server contain the following error entry:

terminating walsender process due to replication timeout


Currently my configuration is the following:

wal_sender_timeout = 1s

wal_receiver_timeout = 1s

wal_receiver_status_interval = 10s


I see that some people faced this situation:

https://www.postgresql.org/message-id/109968546.289.1460409481048.JavaMail.pbrunnen%40Station8.local
The suggestion was increasing wal_sender_timeout  parameter.


On the one hand I understand that  if my database gets bigger it will require bigger value of wal_sender_timeout. On the other hand I use wal_sender_timeout = 1s on purpose in  order to detect if network bad.


Could you please suggest an appropriate configuration, sensible relations between configuration parameters or any other approach of database synchronization which overcomes this issue?


Thank you in advance,
Andrei Yahorau



-- 
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt
--------------AEA7F847BB3D2C980E5AB0A6--