pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedCreating new cluster by copying directory?
8+ messages / 5 participants
[nested] [flat]
* Creating new cluster by copying directory?
@ 2013-07-11 20:31 Wells Oliver <wellsoliver@gmail.com>
2013-07-11 20:41 ` Re: Creating new cluster by copying directory? Gilberto Castillo <gilberto.castillo@etecsa.cu>
0 siblings, 1 reply; 8+ messages in thread
From: Wells Oliver @ 2013-07-11 20:31 UTC (permalink / raw)
To: pgsql-admin
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?
--
Wells Oliver
wellsoliver@gmail.com
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Creating new cluster by copying directory?
2013-07-11 20:31 Creating new cluster by copying directory? Wells Oliver <wellsoliver@gmail.com>
@ 2013-07-11 20:41 ` Gilberto Castillo <gilberto.castillo@etecsa.cu>
2013-07-11 20:42 ` Re: Creating new cluster by copying directory? Wells Oliver <wellsoliver@gmail.com>
0 siblings, 1 reply; 8+ messages in thread
From: Gilberto Castillo @ 2013-07-11 20:41 UTC (permalink / raw)
To: Wells Oliver <wellsoliver@gmail.com>; +Cc: pgsql-admin
> 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;
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Creating new cluster by copying directory?
2013-07-11 20:31 Creating new cluster by copying directory? Wells Oliver <wellsoliver@gmail.com>
2013-07-11 20:41 ` Re: Creating new cluster by copying directory? Gilberto Castillo <gilberto.castillo@etecsa.cu>
@ 2013-07-11 20:42 ` Wells Oliver <wellsoliver@gmail.com>
2013-07-11 20:48 ` Re: Creating new cluster by copying directory? Kevin Grittner <kgrittn@ymail.com>
2013-07-11 20:50 ` Re: Creating new cluster by copying directory? Gilberto Castillo <gilberto.castillo@etecsa.cu>
2013-07-11 20:54 ` Re: Creating new cluster by copying directory? Jerry Sievers <gsievers19@comcast.net>
0 siblings, 3 replies; 8+ messages in thread
From: Wells Oliver @ 2013-07-11 20:42 UTC (permalink / raw)
To: gilberto.castillo@etecsa.cu; +Cc: pgsql-admin
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?
On Thu, Jul 11, 2013 at 1:41 PM, Gilberto Castillo <
gilberto.castillo@etecsa.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@gmail.com
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Creating new cluster by copying directory?
2013-07-11 20:31 Creating new cluster by copying directory? Wells Oliver <wellsoliver@gmail.com>
2013-07-11 20:41 ` Re: Creating new cluster by copying directory? Gilberto Castillo <gilberto.castillo@etecsa.cu>
2013-07-11 20:42 ` Re: Creating new cluster by copying directory? Wells Oliver <wellsoliver@gmail.com>
@ 2013-07-11 20:48 ` Kevin Grittner <kgrittn@ymail.com>
2 siblings, 0 replies; 8+ messages in thread
From: Kevin Grittner @ 2013-07-11 20:48 UTC (permalink / raw)
To: Wells Oliver <wellsoliver@gmail.com>; gilberto.castillo@etecsa.cu <gilberto.castillo@etecsa.cu>; +Cc: pgsql-admin
Wells Oliver <wellsoliver@gmail.com> wrote:
> 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?
As long as you copy the whole $PGDATA tree while the source cluster
is stopped, or use PITR recovery techniques:
http://www.postgresql.org/docs/9.2/interactive/backup.html
Of course, the machines must be of the same architecture.
--
Kevin Grittner
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Creating new cluster by copying directory?
2013-07-11 20:31 Creating new cluster by copying directory? Wells Oliver <wellsoliver@gmail.com>
2013-07-11 20:41 ` Re: Creating new cluster by copying directory? Gilberto Castillo <gilberto.castillo@etecsa.cu>
2013-07-11 20:42 ` Re: Creating new cluster by copying directory? Wells Oliver <wellsoliver@gmail.com>
@ 2013-07-11 20:50 ` Gilberto Castillo <gilberto.castillo@etecsa.cu>
2 siblings, 0 replies; 8+ messages in thread
From: Gilberto Castillo @ 2013-07-11 20:50 UTC (permalink / raw)
To: Wells Oliver <wellsoliver@gmail.com>; +Cc: gilberto.castillo@etecsa.cu; pgsql-admin
> 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, but the server where copy is stop.
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;
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Creating new cluster by copying directory?
2013-07-11 20:31 Creating new cluster by copying directory? Wells Oliver <wellsoliver@gmail.com>
2013-07-11 20:41 ` Re: Creating new cluster by copying directory? Gilberto Castillo <gilberto.castillo@etecsa.cu>
2013-07-11 20:42 ` Re: Creating new cluster by copying directory? Wells Oliver <wellsoliver@gmail.com>
@ 2013-07-11 20:54 ` Jerry Sievers <gsievers19@comcast.net>
2013-07-11 21:36 ` Re: Creating new cluster by copying directory? Wells Oliver <wellsoliver@gmail.com>
2 siblings, 1 reply; 8+ messages in thread
From: Jerry Sievers @ 2013-07-11 20:54 UTC (permalink / raw)
To: Wells Oliver <wellsoliver@gmail.com>; +Cc: gilberto.castillo@etecsa.cu; pgsql-admin
Wells Oliver <wellsoliver@gmail.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.castillo@etecsa.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@gmail.com
>
--
Jerry Sievers
Postgres DBA/Development Consulting
e: postgres.consulting@comcast.net
p: 312.241.7800
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Creating new cluster by copying directory?
2013-07-11 20:31 Creating new cluster by copying directory? Wells Oliver <wellsoliver@gmail.com>
2013-07-11 20:41 ` Re: Creating new cluster by copying directory? Gilberto Castillo <gilberto.castillo@etecsa.cu>
2013-07-11 20:42 ` Re: Creating new cluster by copying directory? Wells Oliver <wellsoliver@gmail.com>
2013-07-11 20:54 ` Re: Creating new cluster by copying directory? Jerry Sievers <gsievers19@comcast.net>
@ 2013-07-11 21:36 ` Wells Oliver <wellsoliver@gmail.com>
2013-07-15 05:35 ` Re: Creating new cluster by copying directory? Sergey Konoplev <gray.ru@gmail.com>
0 siblings, 1 reply; 8+ messages in thread
From: Wells Oliver @ 2013-07-11 21:36 UTC (permalink / raw)
To: Jerry Sievers <gsievers19@comcast.net>; +Cc: gilberto.castillo@etecsa.cu; 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@comcast.net>wrote:
> Wells Oliver <wellsoliver@gmail.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.castillo@etecsa.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@gmail.com
> >
>
> --
> Jerry Sievers
> Postgres DBA/Development Consulting
> e: postgres.consulting@comcast.net
> p: 312.241.7800
>
--
Wells Oliver
wellsoliver@gmail.com
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Creating new cluster by copying directory?
2013-07-11 20:31 Creating new cluster by copying directory? Wells Oliver <wellsoliver@gmail.com>
2013-07-11 20:41 ` Re: Creating new cluster by copying directory? Gilberto Castillo <gilberto.castillo@etecsa.cu>
2013-07-11 20:42 ` Re: Creating new cluster by copying directory? Wells Oliver <wellsoliver@gmail.com>
2013-07-11 20:54 ` Re: Creating new cluster by copying directory? Jerry Sievers <gsievers19@comcast.net>
2013-07-11 21:36 ` Re: Creating new cluster by copying directory? Wells Oliver <wellsoliver@gmail.com>
@ 2013-07-15 05:35 ` Sergey Konoplev <gray.ru@gmail.com>
0 siblings, 0 replies; 8+ messages in thread
From: Sergey Konoplev @ 2013-07-15 05:35 UTC (permalink / raw)
To: Wells Oliver <wellsoliver@gmail.com>; +Cc: Jerry Sievers <gsievers19@comcast.net>; pgsql-admin
On Thu, Jul 11, 2013 at 2:36 PM, Wells Oliver <wellsoliver@gmail.com> wrote:
> 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?
It should work. I would also suggest you to use --xlog-method=stream
so the copy will be more caught up.
-X method
--xlog-method=method
Includes the required transaction log files (WAL files) in the backup.
This will include all transaction logs generated during the backup. If
this option is specified, it is possible to start a postmaster
directly in the extracted directory without the need to consult the
log archive, thus making this a completely standalone backup.
The following methods for collecting the transaction logs are supported:
[skipped]
s
stream
Stream the transaction log while the backup is created. This will open
a second connection to the server and start streaming the transaction
log in parallel while running the backup. Therefore, it will use up
two slots configured by the max_wal_senders parameter. As long as the
client can keep up with transaction log received, using this mode
requires no extra transaction logs to be saved on the master.
>
>
> On Thu, Jul 11, 2013 at 1:54 PM, Jerry Sievers <gsievers19@comcast.net>
> wrote:
>>
>> Wells Oliver <wellsoliver@gmail.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.castillo@etecsa.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@gmail.com
>> >
>>
>> --
>> Jerry Sievers
>> Postgres DBA/Development Consulting
>> e: postgres.consulting@comcast.net
>> p: 312.241.7800
>
>
>
>
> --
> Wells Oliver
> wellsoliver@gmail.com
--
Kind regards,
Sergey Konoplev
PostgreSQL Consultant and DBA
Profile: http://www.linkedin.com/in/grayhemp
Phone: USA +1 (415) 867-9984, Russia +7 (901) 903-0499, +7 (988) 888-1979
Skype: gray-hemp
Jabber: gray.ru@gmail.com
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2013-07-15 05:35 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-07-11 20:31 Creating new cluster by copying directory? Wells Oliver <wellsoliver@gmail.com>
2013-07-11 20:41 ` Gilberto Castillo <gilberto.castillo@etecsa.cu>
2013-07-11 20:42 ` Wells Oliver <wellsoliver@gmail.com>
2013-07-11 20:48 ` Kevin Grittner <kgrittn@ymail.com>
2013-07-11 20:50 ` Gilberto Castillo <gilberto.castillo@etecsa.cu>
2013-07-11 20:54 ` Jerry Sievers <gsievers19@comcast.net>
2013-07-11 21:36 ` Wells Oliver <wellsoliver@gmail.com>
2013-07-15 05:35 ` Sergey Konoplev <gray.ru@gmail.com>
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