start a New page
User:Roger/Wg bu
From Wikigogy
How I backup the Wikigogy server
Contents |
[edit] Server side
[edit] mysqldump
I use:
mysqldump -p roger_wgdb > roger_wgdb.`date +%Y-%m-%d`.sql
use --skip-opt ? -- $ mysqldump -p --skip-opt roger_wgdb > roger_wgdb.`date +%Y-%m-%d`.sql
Then copy ~/BU/wikigogy.____-__-__.sql to another box for safekeeping with scp or, as I do below, with rsync.
- See http://meta.wikimedia.org/wiki/Database_dump_and_restore_examples
- man mysqldump
- I have not investigated mixing in incremental dumps yet but eventually I will need to, to save space.
[edit] mysql
To revert to a saved version:
mysql -p roger_wgdb < file.sql
[edit] cronjob
I have not set this up yet but it could run the mysqldump automatically say once a day.
[edit] Safekeeping box side
Do a fresh mysqldump on the server side first, see above.
Then do rsync, below, on the safekeeping box to move that fresh mysqldump to safekeeping.
I initiate rsync from the safekeeping box (at home) instead of from the server (at the data center) simply because my safekeeping box does not have a static ip address and thus I don't know how to access it from the server, but I can access the server from my desktop box easily because the server does have a static ip address.
[edit] rsync
Run my
~/BU-Dreamhost-rsync.sh
It is a shell script containing the following bash commands (which run rsync on the safekeeping box to copy stuff from the server):
Maybe this?: rsync -av --delete --stats --progress m2_cn@wikigogy.org:/home/m2_cn /home/roger/BU-Dreamhost-rsync/home..m2_cn/ cp -R /home/roger/BU-Dreamhost-rsync/ /home/roger/BU-Dreamhost-rsync.`date+%Y-%m-%d`
- The last line cans and dates the stuff so it wont get overwritten next time, in case I need to revert to a previous date to recover from some screw up or vandalism on the server.
[edit] cronjob
I have not set this up yet but it could run the rsync automatically say once a day.
man cron man cronjob

