Re: pg_basebackup fails: could not receive data from WAL stream: server closed the connection unexpectedly

From: AYahorau(at)ibagroup(dot)eu
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: MikalaiKeida(at)ibagroup(dot)eu, pgsql-admin <pgsql-admin(at)postgresql(dot)org>, Shreeyansh Dba <shreeyansh2014(at)gmail(dot)com>
Subject: Re: pg_basebackup fails: could not receive data from WAL stream: server closed the connection unexpectedly
Date: 2018-12-04 15:29:41
Message-ID: OFD37D6500.8D41B158-ON43258359.00548653-43258359.00551D40@iba.by
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Thanks Stephen,

Is there any relation/dependency between status-interval and
wal_sender_timeot.?

I am asking this because even if I set status-interval for pg_basebackup
to 1 second( the most frequent feedback) I get the same error:
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

because the server terminates wal_sender due to replication timeout.

Best regards,
Andrei

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: AYahorau(at)ibagroup(dot)eu,
Cc: Shreeyansh Dba <shreeyansh2014(at)gmail(dot)com>,
MikalaiKeida(at)ibagroup(dot)eu, pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Date: 04/12/2018 17:05
Subject: Re: pg_basebackup fails: could not receive data from WAL
stream: server closed the connection unexpectedly

Greetings,

* AYahorau(at)ibagroup(dot)eu (AYahorau(at)ibagroup(dot)eu) wrote:
> 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();

It doesn't seem clear what the goal here is- if you are looking to have
two DB servers that are synchronized, then using pg_basebackup to get
the initial copy and then running PostgreSQL as a replica would be the
right approach.

I certainly wouldn't recommend trying to hack together something with
rsync or cp or using the exclusive backup mode at all- if the system
crashes when that exclusive backup is happening, the database won't come
back up.

> 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?

No, I don't see any bug here, but if you adjust the timeout values on
the server then you need to tell pg_basebackup to send messages to the
server more frequently or it's going to get timed out. That's what the
--status-interval option in pg_basebackup is for.

Thanks!

Stephen
[attachment "signature.asc" deleted by Andrei Yahorau/IBA]

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Stephen Frost 2018-12-04 15:38:14 Re: pg_basebackup fails: could not receive data from WAL stream: server closed the connection unexpectedly
Previous Message Stephen Frost 2018-12-04 14:05:12 Re: pg_basebackup fails: could not receive data from WAL stream: server closed the connection unexpectedly