db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <Knut.Hat...@Sun.COM>
Subject Re: Replication - switching back after failover
Date Tue, 14 Oct 2008 14:40:11 GMT
Andrew Lawrenson <andrew.lawrenson@coppereye.com> writes:

> Jorgen/Knut,
>
>   many thanks for this.
>
>   one clarification - "should" it work in the scenario where on
>   the master you do a restore from the slave & roll forward
>   through the logs? (as opposed to just copying the whole
>   database while both are shut down)

I think it "should" work if you do something like this:

1. On the slave, enable log archiving and back up the database
(SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE,
http://db.apache.org/derby/docs/10.4/ref/rrefbackupdbenablelogproc.html)

2. Copy the backed up database to the master

3. Stop the slave

4. Copy the archived log to the master

5. On both the master and the slave: Restore the database from the
backup and the archived log

6. On both the master and the slave: Do a clean shutdown of the restored
db

7. On the slave: Boot the restored database with startSlave=true

8. On the master: Boot the restored database with startMaster=true

The main issue here is that the two databases should be identical when
replication is started, which I think they will be after having been
restored from the same set of logs. And they should not have any
unprocessed log, therefore we need the clean shutdown of both databases.

This should allow you to reduce the downtime to just the time it takes
to copy the logs and restore the database. (Actually, I think you may
even keep the slave running until right before you start copying the
last log file, since the older log files won't be modified by it.)

Please report back if you manage to get this working. I don't think
anyone has ever tested this, and it is certainly not documented anywhere
(yet), so it would be interesting to hear if it works.

-- 
Knut Anders

Mime
View raw message