Re: How to move a 11.4 cluster to another Linux host, but empty?

From: Paul Förster <paul(dot)foerster(at)gmail(dot)com>
To: Matthias Apitz <guru(at)unixarea(dot)de>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: How to move a 11.4 cluster to another Linux host, but empty?
Date: 2020-05-01 08:23:37
Message-ID: 999AE92C-F74D-4399-8FE1-1DB80D08915D@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Matthias,

> On 01. May, 2020, at 10:10, Matthias Apitz <guru(at)unixarea(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matthias Apitz 2020-05-01 08:31:48 Re: How to move a 11.4 cluster to another Linux host, but empty?
Previous Message Matthias Apitz 2020-05-01 08:10:29 How to move a 11.4 cluster to another Linux host, but empty?