pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris Browne <cbbrowne@acm.org>
To: pgsql-admin@postgresql.org
Subject: Re: Synchronize Backup to another remote database
Date: Mon, 22 May 2006 23:02:00 +0000
Message-ID: <60zmh964uv.fsf@dba2.int.libertyrms.com> (raw)
References: <OF8F47556A.96A3C022-ON48257170.0008078F@pengroup.com.my>
	<20060522164543.GU64371@pervasive.com>

jnasby@pervasive.com ("Jim C. Nasby") writes:
> On Tue, May 16, 2006 at 09:35:57AM +0800, kah_hang_ang@toray.com.my wrote:
>> Currently we want to upgrade postgresql to 8.1.3 but our current postgresql
>> database (v7.2.2) is use in the production line so we can't stop the
>> current database.
>> So is there any way to synchronize backup the current postgresql database
>> to another remote postgresql database without interrupt our current
>> postgresql database?
>
> You could maybe, possibly, theoretically hack Slony to run against 7.2.
> I know someone did this to get slony to run on 7.3. You'd want to use
> an old version of Slony, which means you'd only be able to go from 7.2
> to 7.4. But once you were on 7.4, you could use the most recent Slony to
> go from 7.4 to 8.1.

Actually, the hack was on version 7.2.

-----------------------------------------------------------------------
<http://linuxfinances.info/info/faq.html#AEN44224;

 This is approximately what you need to do:

    * Take the 7.3 templates and copy them to 7.2 -- or otherwise hardcode the version your using to pick up the 7.3 templates
    * Remove all traces of schemas from the code and sql templates. I basically changed the "." to an "_".
    * Bunch of work related to the XID datatype and functions. For example, Slony creates CASTs for the xid to xxid and back -- but 7.2 cannot create new casts that way so you need to edit system tables by hand. I recall creating an Operator Class and editing several functions as well.
    * sl_log_1 will have severe performance problems with any kind of data volume. This required a number of index and query changes to optimize for 7.2. 7.3 and above are quite a bit smarter in terms of optimizations they can apply.
    * Don't bother trying to make sequences work. Do them by hand after the upgrade using pg_dump and grep. 

Of course, now that you have done all of the above, it's not
compatible with standard Slony now. So you either need to implement
7.2 in a less hackish way, or you can also hack up slony to work
without schemas on newer versions of PostgreSQL so they can talk to
each other.

Almost immediately after getting the DB upgraded from 7.2 to 7.4, we
deinstalled the hacked up Slony (by hand for the most part), and
started a migration from 7.4 to 7.4 on a different machine using the
regular Slony. This was primarily to ensure we didn't keep our system
catalogues which had been manually fiddled with.

All that said, we upgraded a few hundred GB from 7.2 to 7.4 with about
30 minutes actual downtime (versus 48 hours for a dump / restore
cycle) and no data loss.
-----------------------------------------------------------------------

I'm not sure what to suggest with regards to Slony-I versioning; newer
versions have cleaned out some bugs, so I'd tend to think that version
1.1.5 might be the "best" starting point.

But it's possible that there have been changes between the 1.0 and 1.1
series that would make life more difficult for users of PostgreSQL
7.2...

After fighting through this, it would be worthwhile keeping the
modified code and SQL scripts; that could make life easier for others
that want to do this.  We'd not be keen on letting this code into the
"main line," but if it could help others running elderly versions,
having some sort of release for 7.2 would be nice...

> Another possibility is using a command-based replicator, like
> pgmirror, or what Continuent offers. But you need to understand the
> drawbacks of such a method.

Indeed...
-- 
(reverse (concatenate 'string "moc.enworbbc" "@" "enworbbc"))
http://cbbrowne.com/info/languages.html
"Much of this software was user-friendly, meaning that it was intended
for users who did not know anything about computers, and furthermore
had absolutely no intention whatsoever of learning."
-- A. S. Tanenbaum, "Modern Operating Systems, ch 1.2.4"



view thread (3+ messages)

Message-ID: <60zmh964uv.fsf@dba2.int.libertyrms.com>
Permalink:  ../60zmh964uv.fsf@dba2.int.libertyrms.com/
Also on:    postgresql.org/message-id/60zmh964uv.fsf@dba2.int.libertyrms.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: cbbrowne@acm.org
  Subject: Re: Synchronize Backup to another remote database
  In-Reply-To: <60zmh964uv.fsf@dba2.int.libertyrms.com>
  References: <OF8F47556A.96A3C022-ON48257170.0008078F@pengroup.com.my> <20060522164543.GU64371@pervasive.com> <60zmh964uv.fsf@dba2.int.libertyrms.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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