Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-24-2008, 11:40 AM
Guest210212002
Guest
 
Posts: n/a
Default Friendly reminder: backup, backup, backup.

You know you're out there, Mr. I-Just-Install-Plugins-At-Will guy. When you install something, anything, back up your db first!. It's rarely the hack's fault when your tables crash. This morning I installed one of Paul's mods, and my mysql service timed out in the middle of it. This isn't Paul's fault, or the hack - it's just bad luck.

Fortunately, an hour later and a couple of cups of coffee and my site's good to go because I am a total fanatic for backing up. If you have SSH access, it's one command. Make a shell script. Stick this in it:

Code:
# Site Backup
mysqldump --opt -Q -u username -ppassword dbname > /path/to/your/backups/db-`date --iso-8601`.sql
Run it, and it'll make a datestamped backup of your DB. Then install your product. If it's a clean install, just remove the file. The process is quick and painless, and will no doubt save you hours of frustrating table repairs, angry vb.org PM's to boofo for no reason*, and grey hairs.

So before you click that Import Product link, do yourself a favor and back your stuff up!.

*that's what I do, anyway

--------------- Added [DATE]1203860745[/DATE] at [TIME]1203860745[/TIME] ---------------

Also, don't post things in the wrong forum like I just did. You'll feel silly.

(Moved now )
Reply With Quote
  #2  
Old 02-24-2008, 03:27 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Very good advice! I must admit that I often forget to backup prior to adding a Mod. I always add the mod to my test site first, and if there are no problems, then I add it to my real site. (Which reminds me that I need to backup my test site!).

Also, another good thing is to remember to backup your files also. If you don't store attachments/avatars/etc in the database, then they are in the filesystem and won't get backed up when you backup your database!
Reply With Quote
  #3  
Old 02-24-2008, 03:50 PM
nexialys
Guest
 
Posts: n/a
Default

This have to be the Tip of the Month...
(and we can repeat it monthly!)
Reply With Quote
  #4  
Old 02-24-2008, 04:11 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It might even rate a weekly shout around here.
Reply With Quote
  #5  
Old 02-24-2008, 06:15 PM
Guest210212002
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by Lynne View Post
Very good advice! I must admit that I often forget to backup prior to adding a Mod. I always add the mod to my test site first, and if there are no problems, then I add it to my real site. (Which reminds me that I need to backup my test site!).

Also, another good thing is to remember to backup your files also. If you don't store attachments/avatars/etc in the database, then they are in the filesystem and won't get backed up when you backup your database!
I actually use the db script in cron.daily, and toss this guy in cron.weekly to nab the filesystem.

Code:
# Filesystem backup
tar -czf /path/to/backups/sitename-`date --iso-8601`.tar.gz /path/to/httpdocs/
Reply With Quote
  #6  
Old 02-24-2008, 06:42 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Chris, can you PM exactly what you use for the file backups? I'm not sure I understand it fully.

@ Lynne - Thanks for the reminder on the file backups. Great idea!
Reply With Quote
  #7  
Old 02-24-2008, 06:45 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I wrote a script which I use to backup all my files. I run the attachment one once a week (7 GB of attachments) and the one for avatars, torrents, profile pics everynight. But, I also have all my files rsynced to an offsite server every night.
Reply With Quote
  #8  
Old 02-24-2008, 06:53 PM
Guest210212002
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by Boofo View Post
Chris, can you PM exactly what you use for the file backups? I'm not sure I understand it fully.

@ Lynne - Thanks for the reminder on the file backups. Great idea!
I actually wrote it all up once. Here's the filesystem howto:

https://vborg.vbsupport.ru/showthread.php?t=105728

It's the same thing for the DB. In /etc/cron.daily I have a script called backup.sh, that contains this:

Code:
# Sevenstring.org Backup
mysqldump --opt -Q -u username -ppassword dbname > /path/to/your/backups/sevenstring-`date --iso-8601`.sql
Sleep 5
# Client 1 Backup
mysqldump --opt -Q -u username -ppassword dbname > /path/to/your/backups/client1-`date --iso-8601`.sql
sleep 5
# Client 2 Backup
mysqldump --opt -Q -u username -ppassword dbname > /path/to/your/backups/
And in /etc/cron.weekly, another file called weekly.sh that contains that, with the filesystem tacked on the end, like this:

Code:
#! /bin/bash
# Compressed Directory Tree Backup
tar -czvf /your/backup/folder/sitedata-`date --iso-8601`.tar.gz /path/to/your/siteroot/httpdocs/
# Sevenstring.org Backup
mysqldump --opt -Q -u username -ppassword dbname > /path/to/your/backups/sevenstring-`date --iso-8601`.sql
Sleep 5
# Client 1 Backup
mysqldump --opt -Q -u username -ppassword dbname > /path/to/your/backups/client1-`date --iso-8601`.sql
sleep 5
# Client 2 Backup
mysqldump --opt -Q -u username -ppassword dbname > /path/to/your/backups/
The format for the output file is just the linux date call, so this:

sitedata-`date --iso-8601`.tar.gz

Makes a file called sitedata-2008-02-24.tar.gz. In the same vein, the dtabase backups are named things like sevenstring-2008-02-24.sql, etc, etc, so that the filenames ARE the dates they are created. You can change 'sitedata' to whatever you want to call it.

Short version: Make textfile. Stick commands in, copy it to /etc/cron.daily (or weekly/monthly). So when I am about to install a plugin, I just run the script manually:

sh /etc/cron.weekly/backup.sh

And it does a backup stamped with today's date that I can restore from if and when I screw something up.
Reply With Quote
  #9  
Old 02-24-2008, 07:55 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, now I'm more confused than I was before. LOL
Reply With Quote
  #10  
Old 02-25-2008, 04:04 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

They are bash commands you do from the command line. It needs SSH access into the server.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:26 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05225 seconds
  • Memory Usage 2,248KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (6)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_imicons
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete