pg_basebackup "Permission denied" error when initiating streaming replication

From: "Frans Simmelvuo (Papula-Nevinpat)" <Frans(dot)Simmelvuo(at)papula-nevinpat(dot)com>
To: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: pg_basebackup "Permission denied" error when initiating streaming replication
Date: 2024-05-07 10:28:23
Message-ID: GV1PR01MB85793D04E48B1855BCA755ABA7E42@GV1PR01MB8579.eurprd01.prod.exchangelabs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I'm trying to initiate streaming replication between two Postgres 10 servers on Windows. The source cluster is of size ~450gb, and the cluster consists of the primary data folder, and two separated tablespaces. One of the tablespaces is configured with a symbolic link inside Windows.

Now, the problem I'm encountering is the following:
I call pg_basebackup at the target as follows:
>> pg_basebackup -h <SRC_IP> -U <SUPERUSER> -p <SRC_PORT> -W -D <TARGETDIR> -T "C:\Server Files\Data\ProgramsData\PostgreSQL\10\data\base\demo_tablespace"=E:\PG_tablespace_data\10\demo_tablespace -T "C:\Server Files\Data\ProgramsData\PostgreSQL\10\data\base\tsb_tablespace"=E:\PG_tablespace_data\10\tsb_tablespace -P -R -v

This starts the pg_basebackup and it runs without problems for the duration of copying the 450gbs of data.
Then the output is the following:

>>pg_basebackup: initiating base backup, waiting for checkpoint to complete
>>pg_basebackup: checkpoint complete
>>pg_basebackup: write-ahead log start point: 181/9000028 on timeline 1
>>pg_basebackup: starting background WAL receiver
>>432917950/482036946 kB (100%), 3/3 tablespaces
>>pg_basebackup: could not get write-ahead log end position from server: ERROR: could not open file "./base/demo_tablespace": Permission denied

The demo_tablespace is the one that is a symbolic link from another folder. After the error, I find that all the data is copied to the target tablespaces and primary data directory, but the data directory is missing all pg_... directories and configuration files. So no running database at target.

I'm running the source Postgres service on Windows as a local account, the command is given with administrator cmd and the ./base/demo_tablespace folder's security settings should have all needed permissions for the operation.

I have a hard time understanding why pg_basebackup can retrieve the data from the ./base/demo_tablespace directory, and then suddenly gets denied. I'm running out of ideas on what to try next.

BR,
Frans Simmelvuo

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2024-05-07 15:08:47 Forcing INTERVAL days display, even if the interval is less than one day
Previous Message HORDER Philip 2024-05-07 09:38:51 RE: Restore of a reference database kills the auto analyze processing.