[Bucardo-general] how to re-sync databases?
Richard Martin
richard.martin at tascomi.com
Wed Nov 5 19:16:11 UTC 2008
Thanks Greg
Not wanting to appear a complete fool but...
> Are you purging the tables with the bucardo_purge_delta() functions?
to purge the deltas, do I just execute the SQL in a cronjob every 5
mins:
>> (SELECT bucardo_purge_delta('5
>> minutes'::interval);
as you mentioned? I think so but, since this is now in a live
database I'm getting paranoid in case I break the whole thing...
Thanks again
Richard
On 5 Nov 2008, at 18:23, Greg Sabino Mullane wrote:
>
>> 1) I think it would be better to use a full copy sync as you
>> mentioned
>> in a previous post, I can set up one, but how do I get it to run only
>> the once?
>> After it was complete it got kicked off again. What I'd like is
>> a pointer on how to run a full copy sync then once that's finished it
>> will run a SWAP.
>
> Setup the swap sync. At this point, all changes to the table will be
> recorded in the bucardo_delta table. If there is already a sync in
> place,
> you can simply remove rows from the bucardo_delta and bucardo_track
> tables
> for the table in question.
>
> Setup a fullcopy sync. These do not fire until you tell them to. Make
> sure that stayalive, kidsalive, and ping is false in the sync table
> for
> this sync. Once it is in place, initiate a fullcopy by kicking off
> that
> sync. The fullcopy sync will not create bucardo_delta entries on
> either
> side.
>
> When it is done, you can turn on the swap sync again. The fullcopy
> should
> only fire when you request it to.
>
>> 2) One other question is (I'm no expert on PostgreSQL) but I've been
>> playing with the setup and the triggers have been firing all day
>> every
>> day on the live database as the database is now used and is LIVE - I
>> now have lots and lots of deltas, which I don't really need. I think
>> I need to "clean" them out, do a full copy sync then start a SWAP
>> process to run indefinitely - once I get that then the two machines
>> will be fully synced. The secondary machine is really just a hot
>> backup.
>>
>> Can anyone give me fairly clear direction on how to achieve this -
>> once I get this working I promise to document the whole process - my
>> sake if for no one else!
>
> Are you purging the tables with the bucardo_purge_delta() functions?
> These
> should be run as a cronjob to keep the bucardo_delta and bucardo_track
> tables slim and trim. On busy sites, you might have it run every 5
> minutes
> with a 5 minute 'window' (SELECT bucardo_purge_delta('5
> minutes'::interval);
>
> As I said above, if you are about to do a full copy, you blow away
> that
> tables entires from the bucardo_delta and bucardo_track tables if
> you are
> sure the tables are in sync as you need them to be.
>
> On a related note, there is a long-term todo for a function to
> "compress"
> the bucardo_delta entries. Originally, an upsert was used for this
> table,
> but it was way too slow, so now we simply insert to the table on every
> action, and similar rows are consolidated with a DISTINCT call in the
> Bucardo code. But for syncs that don't run often and tables that
> change a
> lot, a method to prune the "duplicate" bucardo_delta rows would help.
>
> --
> Greg Sabino Mullane greg at endpoint.com
> End Point Corporation
More information about the Bucardo-general
mailing list