Search Postgresql Archives

Re: Highly academic: local etcd & Patroni Cluster for testing on a single host

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ian,

> On 26. Feb, 2020, at 01:38, Ian Barwick <ian.barwick@xxxxxxxxxxxxxxx> 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. If the latter would be the case then I could just as well set it individually per node as I can with the archive destination.

So, the tablespace location is always /data/pg01a/ts, even on the replica site where it should be /data/pg01b/ts. Hence, on my local cluster, the replica site 'b' always uses the tablespace directory (and thus the files) of the master 'a'.

Cheers,
Paul





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux