From: Paul Förster <paul.foerster@gmail.com>
To: Matthias Apitz <guru@unixarea.de>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: How to move a 11.4 cluster to another Linux host, but empty?
Date: Fri, 1 May 2020 10:23:37 +0200
Message-ID: <999AE92C-F74D-4399-8FE1-1DB80D08915D@gmail.com> (raw)
In-Reply-To: <20200501081029.GA3261@c720-r342378>
References: <20200501081029.GA3261@c720-r342378>
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 directory there.
Alternatively you may specify each directory inside the software directory without explicitly specifying subdirectories to include:
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 problems when 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
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: paul.foerster@gmail.com, guru@unixarea.de
Subject: Re: How to move a 11.4 cluster to another Linux host, but empty?
In-Reply-To: <999AE92C-F74D-4399-8FE1-1DB80D08915D@gmail.com>
References: <20200501081029.GA3261@c720-r342378> <999AE92C-F74D-4399-8FE1-1DB80D08915D@gmail.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