Re: Re-sync slave server

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Patrick B <patrickbakerbr(at)gmail(dot)com>
Cc: bricklen <bricklen(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Re-sync slave server
Date: 2016-06-08 21:38:51
Message-ID: 0c2aaff0-eb48-e052-cf38-5092f702254b@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 06/08/2016 01:47 PM, Patrick B wrote:
>
>
> 2016-06-08 11:03 GMT+12:00 Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com
> <mailto:adrian(dot)klaver(at)aklaver(dot)com>>:
>
> On 06/07/2016 03:22 PM, Patrick B wrote:
>
> One more question guys...
>
> Does the pg_basebackup re-write the data? or do I have to have
> free space?
>
> Like.. the DB is 2 TB.. do I have to have more 2TB? or it will
> use those
> 2TB that already are there?
>
>
> I would suggest taking a tour of:
>
> https://www.postgresql.org/docs/9.2/static/app-pgbasebackup.html
>
>
> It does not say anything about that.. if it will use more space or if it
> will replace the current data and the disk space will be the same

https://www.postgresql.org/docs/9.2/static/app-pgbasebackup.html
"
-D directory
--pgdata=directory

Directory to write the output to. pg_basebackup will create the
directory and any parent directories if necessary. The directory may
already exist, but it is an error if the directory already exists and is
not empty.

When the backup is in tar mode, and the directory is specified as -
(dash), the tar file will be written to stdout.

This option is required.
"

So no it will not replace existing data. You will need to start with an
empty $DATADIR. If you do not want to duplicate the space empty the
existing $DATADIR. If you want to be double safe run the backup to
another directory and then copy it over later.

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Berend Tober 2016-06-08 22:55:14 Re: Using a VIEW as a temporary mechanism for renaming a table
Previous Message Patrick B 2016-06-08 20:47:35 Re: Re-sync slave server