pg_basebackup + SSL error: bad length

Started by Csaba Ragasitsover 7 years ago7 messagesgeneral
Jump to latest
#1Csaba Ragasits
ragasits.csaba@gmail.com

Hello,

I would like to create a streaming replication, when I'm trying the
basebackup from the node1, I've the following errors:

pg_basebackup -P -v -D ./main -h node1 -p 5432 -U repmgr

pg_basebackup: initiating base backup, waiting for checkpoint to complete
pg_basebackup: checkpoint completed
pg_basebackup: write-ahead log start point: 2/13000028 on timeline 1
pg_basebackup: directory "/srv/pgdata/tbs_int302" exists but is not empty
pg_basebackup: removing data directory "./main"

In the node1 postgresql.log:

LOG: could not send data to client: Connection reset by peer
ERROR: base backup could not send data, aborting backup
LOG: SSL error: bad length
LOG: SSL error: bad length
FATAL: connection to client lost

When I set off the SSL in the postgresql.conf, i've the folloving error
message when I try use the pg_basebackup command:
LOG: could not send data to client: Broken pipe
FATAL: connection to client lost

Have you got any information, suggestion how can I solve this errors?

My area:
- Updated Debian GNU/Linux 9
- PostgreSQL 10.5 (Debian 10.5-1.pgdg90+1) on x86_64-pc-linux-gnu, compiled
by gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, 64-bit

Thx,
Csaba

#2Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Csaba Ragasits (#1)
Re: pg_basebackup + SSL error: bad length

On 08/27/2018 02:00 AM, Csaba Ragasits wrote:

Hello,

I would like to create a streaming replication, when I'm trying the
basebackup from the node1, I've the following errors:

pg_basebackup -P -v -D ./main -h node1 -p 5432  -U repmgr

pg_basebackup: initiating base backup, waiting for checkpoint to complete
pg_basebackup: checkpoint completed
pg_basebackup: write-ahead log start point: 2/13000028 on timeline 1
pg_basebackup: directory "/srv/pgdata/tbs_int302" exists but is not empty
pg_basebackup: removing data directory "./main"

In the node1 postgresql.log:

LOG:  could not send data to client: Connection reset by peer
ERROR:  base backup could not send data, aborting backup
LOG:  SSL error: bad length
LOG:  SSL error: bad length
FATAL:  connection to client lost

When I set off the SSL in the postgresql.conf, i've the folloving error
message when I try use the pg_basebackup command:
LOG:  could not send data to client: Broken pipe
FATAL:  connection to client lost

Have you got any information, suggestion how can I solve this errors?

Can you connect to node1 using psql with and without SSL?

Where is node1 relative to the machine you are running pg_basebackup from?

Just to be clear both Postgres instances are running 10.5, correct?

My area:
- Updated Debian GNU/Linux 9
- PostgreSQL 10.5 (Debian 10.5-1.pgdg90+1) on x86_64-pc-linux-gnu,
compiled by gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, 64-bit

Thx,
Csaba

--
Adrian Klaver
adrian.klaver@aklaver.com

#3Csaba Ragasits
ragasits.csaba@gmail.com
In reply to: Adrian Klaver (#2)
Re: pg_basebackup + SSL error: bad length

2018-08-27 16:08 GMT+02:00 Adrian Klaver <adrian.klaver@aklaver.com>:

Can you connect to node1 using psql with and without SSL?

Where is node1 relative to the machine you are running pg_basebackup from?

Just to be clear both Postgres instances are running 10.5, correct?

Every instances are same (10.5) version, and every servers are in the
common VMWARE subnet. The psql connection is working fine with sslmode or
without sslmode.

When I try run it on the localhost (node1), I've same errors too:
pg_basebackup -P -v -D /tmp/main -h localhost -p 5432 -U repmgr

Thx,
Csaba

#4Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Csaba Ragasits (#3)
Re: pg_basebackup + SSL error: bad length

On 08/27/2018 07:38 AM, Csaba Ragasits wrote:

2018-08-27 16:08 GMT+02:00 Adrian Klaver <adrian.klaver@aklaver.com
<mailto:adrian.klaver@aklaver.com>>:

Can you connect to node1 using psql with and without SSL?

Where is node1 relative to the machine you are running pg_basebackup
from?

Just to be clear both Postgres instances are running 10.5, correct?

Every instances are same (10.5) version, and every servers are in the
common VMWARE subnet. The psql connection is working fine with sslmode
or without sslmode.

When I try run it on the localhost (node1), I've same errors too:
pg_basebackup -P -v -D /tmp/main -h localhost -p 5432  -U repmgr

Hmm.

Is there more then one copy of pg_basebackup on the machines?

Maybe from the Debian repo and the PGDG repo.

Thx,
Csaba

--
Adrian Klaver
adrian.klaver@aklaver.com

#5Michael Paquier
michael@paquier.xyz
In reply to: Adrian Klaver (#4)
Re: pg_basebackup + SSL error: bad length

On Mon, Aug 27, 2018 at 04:40:34PM -0700, Adrian Klaver wrote:

Is there more then one copy of pg_basebackup on the machines?

Or this user has created a tablespace directly in the main data folder,
which can cause pg_basebackup to fail because of recursion issues. It
is no wonder that a WARNING is created during a CREATE TABLESPACE if you
do that.
--
Michael

#6Csaba Ragasits
ragasits.csaba@gmail.com
In reply to: Michael Paquier (#5)
Re: pg_basebackup + SSL error: bad length

Hello,

Only one copy is from the pg_basebackup on the machines.

I have only a tablespace only a different location:
/srv/pgdata/tbs_int303

I think I solved the problem:

When I delete manually the /srv/pgdata/tbs_int303 folder, the pg_basebackup
is running fine.

Thank you for your help,
Csaba

2018-08-28 4:49 GMT+02:00 Michael Paquier <michael@paquier.xyz>:

Show quoted text

On Mon, Aug 27, 2018 at 04:40:34PM -0700, Adrian Klaver wrote:

Is there more then one copy of pg_basebackup on the machines?

Or this user has created a tablespace directly in the main data folder,
which can cause pg_basebackup to fail because of recursion issues. It
is no wonder that a WARNING is created during a CREATE TABLESPACE if you
do that.
--
Michael

#7Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Csaba Ragasits (#6)
Re: pg_basebackup + SSL error: bad length

On 08/28/2018 01:58 AM, Csaba Ragasits wrote:

Hello,

Only one copy is from the pg_basebackup on the machines.

I have only a tablespace only a different location:
/srv/pgdata/tbs_int303

I think I solved the problem:

When I delete manually the /srv/pgdata/tbs_int303 folder, the
pg_basebackup is running fine.

Was this tablespace active?

Went back to your original post and realized I skipped over this:

"pg_basebackup: directory "/srv/pgdata/tbs_int302" exists but is not empty
pg_basebackup: removing data directory "./main":

Is /srv/pgdata/tbs_int302 a tablespace also?

Found this:

https://www.postgresql.org/docs/10/static/app-pgbasebackup.html

"Tablespaces will in plain format by default be backed up to the same
path they have on the server, unless the option --tablespace-mapping is
used. Without this option, running a plain format base backup on the
same host as the server will not work if tablespaces are in use, because
the backup would have to be written to the same directory locations as
the original tablespaces."

Looks like you need to use:

-T olddir=newdir
--tablespace-mapping=olddir=newdir

Thank you for your help,
Csaba

2018-08-28 4:49 GMT+02:00 Michael Paquier <michael@paquier.xyz
<mailto:michael@paquier.xyz>>:

On Mon, Aug 27, 2018 at 04:40:34PM -0700, Adrian Klaver wrote:

Is there more then one copy of pg_basebackup on the machines?

Or this user has created a tablespace directly in the main data folder,
which can cause pg_basebackup to fail because of recursion issues.  It
is no wonder that a WARNING is created during a CREATE TABLESPACE if you
do that.
--
Michael

--
Adrian Klaver
adrian.klaver@aklaver.com