Re: How to move a 11.4 cluster to another Linux host, but empty? - Mailing list pgsql-general

From Paul Förster
Subject Re: How to move a 11.4 cluster to another Linux host, but empty?
Date
Msg-id 999AE92C-F74D-4399-8FE1-1DB80D08915D@gmail.com
Whole thread Raw
In response to How to move a 11.4 cluster to another Linux host, but empty?  (Matthias Apitz <guru@unixarea.de>)
Responses Re: How to move a 11.4 cluster to another Linux host, but empty?  (Matthias Apitz <guru@unixarea.de>)
List pgsql-general
Hi Matthias,

> On 01. May, 2020, at 10:10, Matthias Apitz <guru@unixarea.de> wrote:
>
>
> Hello,
>
> I've a 11.4 cluster on a Linux host with 3 production database, all
> below /data/postgresql11.4/ (i.e. the cluster itself is
> /data/postgresql11.4/data) fully configured an running fine. I want to
> move it "cold" (i.e. when it is shutdown) by tar to another host, BUT
> without the database (due to PII and GDPR relevant data). Between the
> source and target host there is no network.
>
> Of course I could, after moving all the PostgreSQL software (all is below a top
> level directory /usr/local/sisis-pap/pgsql, compiled by me) and setup the
> cluster from scratch on the other host, but I wanted to have it all in one shoot by tar.
>
> Is there a way to exclude the databases from the move by tar, or by some
> sophisticated pg_* command?
>
> Thanks
>
>     matthias

you may have a look at the tar man page. tar in Linux has the --exclude=PATTERN option. You may specify the PGDATA
directorythere. 

Alternatively you may specify each directory inside the software directory without explicitly specifying subdirectories
toinclude: 

tar cvf postgresql11.4.tar /data/postgresql11.4/bin /data/postgresql11.4/share ...

Also, why do you have the PGDATA directory inside the software home directory? That makes no sense and only leads to
problemswhen updating or, in your case, moving. 

We use:
/data/postgres/xx.x                  <= with xx.x as PostgreSQL version
/data/<some-prefix>/<cluster_name>   <= as PGDATA

This way, we never have any trouble doing something with the software or database cluster independently from each
other.

Hope, this helps.

Cheers,
Paul




pgsql-general by date:

Previous
From: Matthias Apitz
Date:
Subject: How to move a 11.4 cluster to another Linux host, but empty?
Next
From: Matthias Apitz
Date:
Subject: Re: How to move a 11.4 cluster to another Linux host, but empty?