pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
copy / backup question - copying a data directory while the db is shutdown
3+ messages / 3 participants
[nested] [flat]

* copy / backup question - copying a data directory while the db is shutdown
@ 2014-03-24 22:46 CS_DBA <cs_dba@consistentstate.com>
  2014-03-25 07:40 ` Re: copy / backup question - copying a data directory while the db is shutdown Jürgen Fuchsberger <juergen.fuchsberger@uni-graz.at>
  0 siblings, 1 reply; 3+ messages in thread

From: CS_DBA @ 2014-03-24 22:46 UTC (permalink / raw)
  To: pgsql-admin

Hi All;

If I shutdown a HOT standby slave (via the -m fast command) can I then 
copy the data directory to a "backup" location and be guaranteed that 
the backup copy will start?

For some reason I thought there were issues (or potential issues) with 
this method and a PITR based recovery approach was a better guarantee 
that the copy will start


Thoughts?



-- 
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] 3+ messages in thread

* Re: copy / backup question - copying a data directory while the db is shutdown
  2014-03-24 22:46 copy / backup question - copying a data directory while the db is shutdown CS_DBA <cs_dba@consistentstate.com>
@ 2014-03-25 07:40 ` Jürgen Fuchsberger <juergen.fuchsberger@uni-graz.at>
  2014-03-25 09:03   ` Re: copy / backup question - copying a data directory while the db is shutdown desmodemone <desmodemone@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Jürgen Fuchsberger @ 2014-03-25 07:40 UTC (permalink / raw)
  To: pgsql-admin; +Cc: CS_DBA <cs_dba@consistentstate.com>

Hi,

On 03/24/2014 11:46 PM, CS_DBA wrote:
> Hi All;
> 
> If I shutdown a HOT standby slave (via the -m fast command) can I then
> copy the data directory to a "backup" location and be guaranteed that
> the backup copy will start?

Yes, but you must also backup the WAL archive from which you are
recovering (in case you are using file based log shipping and not
streaming replication). For streaming replication I don't know if it works.

Also you should check if postgres really stopped, since on high load
even the fast option can fail to stop it. Look here on how to do this:
http://www.postgresql.org/message-id/53040588.9020803@coxinc.com
> 
> For some reason I thought there were issues (or potential issues) with
> this method and a PITR based recovery approach was a better guarantee
> that the copy will start
> 
> 
> Thoughts?
> 
Info about other options appreciated.
> 
> 

Best,
Juergen

-- 
| Jürgen Fuchsberger, M.Sc.
| Wegener Center for Climate and Global Change
| University of Graz

Attachments:

  signature.asc (application/pgp-signature, 290B) download

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: copy / backup question - copying a data directory while the db is shutdown
  2014-03-24 22:46 copy / backup question - copying a data directory while the db is shutdown CS_DBA <cs_dba@consistentstate.com>
  2014-03-25 07:40 ` Re: copy / backup question - copying a data directory while the db is shutdown Jürgen Fuchsberger <juergen.fuchsberger@uni-graz.at>
@ 2014-03-25 09:03   ` desmodemone <desmodemone@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: desmodemone @ 2014-03-25 09:03 UTC (permalink / raw)
  To: Jürgen Fuchsberger <juergen.fuchsberger@uni-graz.at>; +Cc: pgsql-admin; CS_DBA <cs_dba@consistentstate.com>

2014-03-25 8:40 GMT+01:00 Jürgen Fuchsberger <
juergen.fuchsberger@uni-graz.at>:

> Hi,
>
> On 03/24/2014 11:46 PM, CS_DBA wrote:
> > Hi All;
> >
> > If I shutdown a HOT standby slave (via the -m fast command) can I then
> > copy the data directory to a "backup" location and be guaranteed that
> > the backup copy will start?
>
> Yes, but you must also backup the WAL archive from which you are
> recovering (in case you are using file based log shipping and not
> streaming replication). For streaming replication I don't know if it works.
>
> Also you should check if postgres really stopped, since on high load
> even the fast option can fail to stop it. Look here on how to do this:
> http://www.postgresql.org/message-id/53040588.9020803@coxinc.com
> >
> > For some reason I thought there were issues (or potential issues) with
> > this method and a PITR based recovery approach was a better guarantee
> > that the copy will start
> >
> >
> > Thoughts?
> >
> Info about other options appreciated.
> >
> >
>
> Best,
> Juergen
>
> --
> | Jürgen Fuchsberger, M.Sc.
> | Wegener Center for Climate and Global Change
> | University of Graz
>
>
>
If you pause the recovery ( pg_xlog_pause )  , the process try to take a
spin lock , and then pause the recovery , so it's consistent, at that point
if you close the database, the consistent is reached, so I think you have
no problem to have a "snapshoot" of the database.

Obviously you need also the archived checkpoint segments if you need to
make a PITR.

Have a nice day

Mat Dba

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2014-03-25 09:03 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-03-24 22:46 copy / backup question - copying a data directory while the db is shutdown CS_DBA <cs_dba@consistentstate.com>
2014-03-25 07:40 ` Jürgen Fuchsberger <juergen.fuchsberger@uni-graz.at>
2014-03-25 09:03   ` desmodemone <desmodemone@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