Re: Creating new cluster by copying directory?

From: Wells Oliver <wellsoliver(at)gmail(dot)com>
To: Jerry Sievers <gsievers19(at)comcast(dot)net>
Cc: gilberto(dot)castillo(at)etecsa(dot)cu, pgsql-admin(at)postgresql(dot)org
Subject: Re: Creating new cluster by copying directory?
Date: 2013-07-11 21:36:05
Message-ID: CAOC+FBWyLa+5wo8Vjh=BD0hLYuRNZVzRH_D+iydRX9oouZp++Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hmm, is it feasible to create a new cluster by using pg_basebackup, e.g:

1. pg_createcluster 9.1 test
2. pg_basebackup --pgdata=/var/lib/postgresql/9.1/test -h localhost -p 5432
3. pg_ctlcluster 9.1 test start

Would that work?

On Thu, Jul 11, 2013 at 1:54 PM, Jerry Sievers <gsievers19(at)comcast(dot)net>wrote:

> Wells Oliver <wellsoliver(at)gmail(dot)com> writes:
>
> > So it's safe to copy the files in /var/lib/postgresql/9.1/main to
> /var/lib/postgresql/9.1/test while main is running?
>
> Yes, provided that you put main in backup mode and then do a PITR when
> you bring up this new test instance.
>
> If your main DB is running but absolutely idle, you might get away
> just starting it in which case the postmaster will do a regular crash
> recovery but I'll presume your source instance 'main' isn't idle.
>
> Study the manual sections relating to backup/PITR.
>
> HTH
>
> > On Thu, Jul 11, 2013 at 1:41 PM, Gilberto Castillo <
> gilberto(dot)castillo(at)etecsa(dot)cu> wrote:
> >
> > > All: it would take ~4 hours to pg_restore a backup. I want to
> quickly
> > > create a duplicate cluster (for testing). My idea:
> > >
> > > 1. pg_ctlcreatecluster 9.1 test
> > > 2. rm /var/lib/postgresql/9.1/test/*
> > > 2. cp /var/lib/postgresql/9.1/main /var/lib/postgresql/9.1/test
> > > 3. pg_ctlcluster 9.1 test start
> > >
> > > Is this viable? If not, is there another way to create a duplicate
> cluster
> > > in a timely fashion?
> >
> > Test Repmgr works with the same philosophy. ;-)
> >
> > Saludos,
> > Gilberto Castillo
> > La Habana, Cuba
> >
> > ---
> > This message was processed by Kaspersky Mail Gateway 5.6.28/RELEASE
> running at host imx3.etecsa.cu
> > Visit our web-site: <http://www.kaspersky.com>, <
> http://www.viruslist.com>
> >
> > --
> > Wells Oliver
> > wellsoliver(at)gmail(dot)com
> >
>
> --
> Jerry Sievers
> Postgres DBA/Development Consulting
> e: postgres(dot)consulting(at)comcast(dot)net
> p: 312.241.7800
>

--
Wells Oliver
wellsoliver(at)gmail(dot)com

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Wells Oliver 2013-07-12 02:07:41 Couldn't start postgres, got no logging, ran postgres manually for info-- help?
Previous Message Jerry Sievers 2013-07-11 20:54:19 Re: Creating new cluster by copying directory?