Thread: replicating to a stopped server
Hello, I have a 'strange' situation: I need to make a replica copy of my database to a reduntant spare computer. The reduntant computer is not running postgres, but postgres is installed. The redundant computer is running in a special run-level (I'm talking Linux here) in which Pg is _not_ running. When the primary computer crashes the redundant one will be rebooted in 'normal' mode and Postgres must be started with the databases from the replica. a) So... how do I replicate a database to a stopped postgres ? b) Is it safe just to copy the /var/lib/pg/* directories to the right place and let Pg boot on that ? c) I know the right tool for this should be 'pg_dump' but it needs a live postgres daemon running, in order to install the replica. Is this correct ? d) Is it viable to start postgres directlly from the dump ? by specifying the dump-file in the cmd line ? thx a lot joao
Joao Miguel Ferreira wrote: > Hello, > > I have a 'strange' situation: > > I need to make a replica copy of my database to a reduntant > spare > computer. > > The reduntant computer is not running postgres, but postgres is > installed. The redundant computer is running in a special > run-level (I'm > talking Linux here) in which Pg is _not_ running. > > When the primary computer crashes the redundant one will be > rebooted in > 'normal' mode and Postgres must be started with the databases > from the > replica. You could use WAL archiving, but you'll want a fairly regular full-backup of PG's files otherwise the recovery could take a long time. See Ch 23 of the manuals for details. -- Richard Huxton Archonet Ltd
On Oct 12, 2007, at 1:59 PM, Richard Huxton wrote: > Joao Miguel Ferreira wrote: >> Hello, >> I have a 'strange' situation: >> I need to make a replica copy of my database to a >> reduntant >> spare >> computer. >> The reduntant computer is not running postgres, >> but postgres is >> installed. The redundant computer is running in a special >> run-level (I'm >> talking Linux here) in which Pg is _not_ running. >> When the primary computer crashes the redundant >> one will be >> rebooted in >> 'normal' mode and Postgres must be started with the databases >> from the >> replica. > > You could use WAL archiving, but you'll want a fairly regular full- > backup of PG's files otherwise the recovery could take a long time. > See Ch 23 of the manuals for details. Are you restricted to keep that second server in that special run- level? If not, I'd consider using pg_standby with WAL archiving to keep your failover server at most a handful of minutes behind. Erik Jones Software Developer | Emma® erik@myemma.com 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate & market in style. Visit us online at http://www.myemma.com
On Fri, 2007-10-12 at 14:09 -0500, Erik Jones wrote: > On Oct 12, 2007, at 1:59 PM, Richard Huxton wrote: > > > Joao Miguel Ferrei > Are you restricted to keep that second server in that special run- > level? If not, I'd consider using pg_standby with WAL archiving to > keep your failover server at most a handful of minutes behind. Well, I can consider having Pg running in that special boot mode... I'll check your suggestion. THX to all. jmf > > Erik Jones > > Software Developer | Emma® > erik@myemma.com > 800.595.4401 or 615.292.5888 > 615.292.0777 (fax) > > Emma helps organizations everywhere communicate & market in style. > Visit us online at http://www.myemma.com > >
On Fri, 2007-10-12 at 19:59 +0100, Richard Huxton wrote: > You could use WAL archiving, but you'll want a fairly regular > full-backup of PG's files otherwise the recovery could take a long time. > See Ch 23 of the manuals for details. Restartable recovery avoids the need to re-sync from the primary as often as was the case with 8.1 and prior. -- Simon Riggs 2ndQuadrant http://www.2ndQuadrant.com