LIR.BE navigation
Online users
1 online user

Replicate

the replicator for database of tikiwiki
print
Where are we on this?

replication scenario


prerequisite

  • create a dir named replicates at tiki root on master and on slave
  • have an accessible master setup with live content and a slave setup with any content (fresh is okay, old replication is okay).

Way down


  • Master is put out of access for visitors with site_closed feature
    master$ mysql -uxxx -pxxx -e "replace into tiki_preferences (name,value) values ('site_closed','y');" dgd_com

  • dump is done with mysqldump
    master$ mysqldump -c -uxxx -pxxx dgd_com > dgd_com.sql

  • patch is produced from last dump from slave. on first time that step is bypassed and dgd_com.sql is just transferred asis.
    master$ cd replicates
    master$ diff -Naur dgd_com.sql dgd_com.slave.sql > patch

  • patch is downloaded in slave using tiki-backups.php page
    master$ cp patch /home/dgd/tiki/dennisgdaniels.com/backups

  • patch is applied on last dump on slave
    slave$ patch -p0 dgd_com.master.sql patch
    slave$ mv dgd_com.master.sql dgd_com.slave.sql
    slave$ mv dgd_com.master.sql.orig dgd_com.oldslave.sql

  • dump the result in db
    slave$ mysql -uxxx -pxxx -e "drop database dgd_com;create database dgd_com"
    salve$ mysql -uxxx -pxxx dgd_com < dgd_com.slave.sql

  • disable website closing on slave
    master$ mysql -uxxx -pxxx -e "replace into tiki_preferences (name,value) values ('site_closed','n');" dgd_com

  • use tiki-admin_system.php to empty templates_c, modules/caches, and recompile all templates to gain some speed (sometimes one pass is bringing error, multiple click on the link can be required because max exec time is exceeded but it's okay).

Way up


  • Slave dumps withmysqldump
    slave$ mysqldump -c -uxxx -pxxx dgd_com > dgd_com.sql

  • Slave produces patch
    slave$ cd replicates
    slave$ diff -Naur dgd_com.sql dgd_com.slave.sql > patch

  • Upload it using tiki-backup.php (yes you can upload any file there no matter what it is).

  • patch is applied on last dump on master
    slave$ patch -p0 dgd_com.master.sql patch
    slave$ mv dgd_com.master.sql.orig dgd_com.slave.sql

  • Dump feed the database
    slave$ mysql -uxxx -pxxx -e "drop database dgd_com;create database dgd_com"
    salve$ mysql -uxxx -pxxx dgd_com < dgd_com.slave.sql

  • then the website is up (website is not closed necessarly on slave, or can be closed after the dump.


Contributors to this page: mose and dgd .
Page last modified on Tuesday 23 of March, 2004 [18:36:51 UTC] by mose.


Page generated in 0.15s
by Tikiwiki
Last update from CVS: Friday 26 of October, 2007 [16:59:54 UTC]