pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ian Barwick <ian.barwick@2ndquadrant.com>
To: Paul Förster <paul.foerster@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Highly academic: local etcd & Patroni Cluster for testing on a single host
Date: Wed, 26 Feb 2020 09:38:27 +0900
Message-ID: <ef8c9642-6ef5-0b1d-9c75-19088ec10ad9@2ndquadrant.com> (raw)
In-Reply-To: <51854B87-A964-4F64-8EC4-8ABF51A0716E@gmail.com>
References: <51854B87-A964-4F64-8EC4-8ABF51A0716E@gmail.com>

On 2020/02/26 0:41, Paul Förster wrote:
> Hi,
> 
> I have set up an etcd & Patroni cluster on a single machine for testing purposes as follows:
> 
> /data/pg01a/db as data directory for the first "node"
> /data/pg01b/db as data directory for the second "node"
> 
> I have set up Patroni to make each PostgreSQL database cluster archive to its own destination, so they won't interfere with each other. All is well and working fine so far. Failover/Switchover works, they are syncing properly, etc.
> 
> Now:
> 
> Inside /data/pg01a and /data/pg01b I also have a directory ts, i.e. /data/pg01a/ts and /data/pg01b/ts to simulate different filesystems.
> 
> If I do a 'create tablespace' and specify its location, I must of course specify either /data/pg01a/ts or /data/pg01b/ts.
> 
> Files with Tables get created as usual, but since it's a replication (sync, by the way), the other tablespace directory will not hold any files, but instead, the replica uses the same files as does the master.
> 
> Is there any way around that, i.e. make the replica use its own files? I found a way to make each archive destination individual despite Patroni, but I can't seem to find a way to do something similar to the tablespaces. Even correcting the symlinks in ${PGDATA}/pg_tblspc manually (and then restart) does not work.
> 
> The explanation is simple: the location is stored inside the database cluster information and is per definition the same across all nodes. So, if 'a' is master and I do "create tablespace test location '/data/pg01a/ts'" it creates files there with the replica 'b' using the *same* destination.
> 
> Still, is there a way to make each node store that information individually? I know, this is highly academic but I only have a single host to do etcd & Patroni cluster experiments on.

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


Regards

Ian Barwick

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





view thread (7+ messages)  latest in thread

Message-ID: <ef8c9642-6ef5-0b1d-9c75-19088ec10ad9@2ndquadrant.com>
Permalink:  ../ef8c9642-6ef5-0b1d-9c75-19088ec10ad9@2ndquadrant.com/
Also on:    postgresql.org/message-id/ef8c9642-6ef5-0b1d-9c75-19088ec10ad9@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ian.barwick@2ndquadrant.com, paul.foerster@gmail.com
  Subject: Re: Highly academic: local etcd & Patroni Cluster for testing on a single host
  In-Reply-To: <ef8c9642-6ef5-0b1d-9c75-19088ec10ad9@2ndquadrant.com>
  References: <51854B87-A964-4F64-8EC4-8ABF51A0716E@gmail.com> <ef8c9642-6ef5-0b1d-9c75-19088ec10ad9@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox