On 2020/02/26 16:55, Paul Förster wrote:
Hi Ian,

On 26. Feb, 2020, at 01:38, Ian Barwick <ian.barw...@2ndquadrant.com> wrote:

Assuming the standby/replica is created using pg_basebackup, you can use the
-T/--tablespace-mapping option to remap the tablespace directories.

no, with Patroni, replicas are always initiated by Patroni. Patroni copies the 
whole PGDATA including everything (postgresql.conf, etc.) in it to the replica 
site. When launching Patroni for the first time, all you need is its yaml 
configuration file and an empty PGDATA. It then will copy the whole master's 
PGDATA as is, launch the replica database cluster and start replication.

Even if Patroni uses pg_basebackup internally (which I assume it does), there 
is no way to pass parameters to it.

Then you can stop the Patroni process on the replica site which in turn takes 
the replica database cluster down, make some configuration changes and launch 
it again. You can of course only make changes to things which don't get 
replicated all over again or are managed by Patroni itself. This is, how I set 
up individual archive destinations for each replication member because the 
initial archive destination of course is replicated, and thus identical, when 
Patroni builds the replica database cluster.

Tablespace mapping just creates the links to the directories in 
${PGDATA}/pg_tblspc to a different location. And since pg_basebackup isn't 
used, there is no way to do that. But I can do that by hand. That is not the 
problem.

The problem is that PostgreSQL keeps the tablespace location inside the database and not in some config file.

It doesn't - it takes the tablespace location directly from the symlink in the 
"pg_tblspc"
directory (since PostgreSQL 9.2), so you can manipulate those manually, 
provided the server
isn't running of course.

Not sure how that would fit in with the Patroni side of things.


Regards


Ian Barwick


--
Ian Barwick                   https://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


Reply via email to