July 19, 2004

Backing Up Your Blog

Updated

Occassionally databases get corrupted, servers fail or web hosts go out of business. So it's a good idea to back up your Movable Type blogs. There are many methods for doing so, a few of which I will cover here. The back-up process is much easier if you are using MySQL as your database, which, by the way, is one good reason to use MySQL over the default Berkeley DB.

TypeMover

TypeMover is a new plugin for the purpose of backing up, restoring, and/or migrating your Movable Type weblog. It is compatible with MT3 and later versions of Movable Type. From the TypeMover website:

TypeMover is a MovableType plugin. It adds backup, restore and migration features that let you get your data in and out of your servers.

The existing Import/Export functionality included in MT is very limited. It only includes the most basic content, it is very slow, and it is very easy to make mistakes and import your data too many times.

TypeMover backs up and restores all your weblog data, including settings, templates, categories, authors, notification subscriptions, trackbacks and pings.

It is also faster and safer.

You can use TypeMover to backup any MT server you have FTP access to, and to restore any backup into the server TypeMover is running on. You can't backup a server without having FTP access, even the server where TypeMover is running

Backing up your MT blogs with MySQL

If you have chosen MySQL as your database for your MT install you can easily back-up the entire blog - entries, comments, authors, templates, etc. - with a simple MySQL "dump" command. The dump command will create a large "dump" file that will have all of the data from your database in it that can be used to easily restore all of your weblogs. To do this you need either command line access to your database or phpMyAdmin installed on your server. The instructions for the dump command and phpMyAdmin can be found in the MT 3.2 User Manual. You can also find instructions for the dump command at MySQL's website. All that said, phpMyAdmin is not installed on my server and I could not get the dump instructions on the MTWiki to work. So I ended up needing some handholding from tech support from my web host. The dump command that ultimately worked on my server was a little different than what is written on the Wiki. Tech support also set up a "cron job" for the server to automatically create a dump file, backing up all of my blogs every night. Every few days I FTP into my server and download the dump file to my desktop, so I have a local copy of the database.

Backing up your MT blogs if you use BerkeleyDB or MySQL

If you are using the default database that comes with Movable Type - BerkeleyDB (or if you are using MySQL and don't have phpMyAdmin and don't want to deal with Unix commands) - the back-up process is a bit more involved. The three elements of your weblog installation that you want to back up are a) the entries with their comments, b) your index and archive templates, and c) your weblog configurations for each of the weblogs that you have on your MT installation. If you are using BerkeleyDB you can download a copy of the db file in binary mode but this won't be useful if you ultimately upload it to a server with a different version of BerkeleyDB.

1. Export your entries.

Using MT's export function you can export all of the entries for a particular blog, and their comments. In MT Weblog Edit, click "Import/Export" from the menu at the left. If you are on a Mac, hold down the "option" key or if you are on a PC hold the shift key. Next (while holding the option or shift) click the link, "Export Entries From yourBlogName" and you can save the export. The resulting file should be saved as a .txt file. If it shows up as "mt.cfg" don't worry - just change it to somethingmemorable.txt. Check the file and make sure the export worked and you have a text file with the data from all of your entries.

If you have multiple blogs on one MT installation, you can follow the above instructions for each weblog. Or you can create an Export Blog that will more easily automate the export process. Instructions for how to create an Export Blog can be found here at the MTWiki. The process is straightforward, requiring the creation of a new "back-up" weblog, the installation of the MTOtherBlog plugin, and the uploading of a rebuild.cgi file.

2. Back up your templates.

Using an FTP client, create a templates folder in the same directory of the index file of each of your blogs. In MT Weblog Edit, for each blog that you have, go to the manage templates section. Template by template, create a backup template by inserting a file name into the �Link this template to a file� window. For example, for your main index template, type in templates/mainindex.tmpl. Rebuild your files. This tip comes from MT forum moderator Girlie (Shelley) and can be found in detail at http://www.thegirliematters.com/tips/archives/0207/back_up_templates_with_link_this_template.php

You can also output your templates using MySQL and PHP.

3. Record your weblog config preferences.

For each weblog, click the "Weblog Config" button in the left-hand menu. For Core Setup, Preferences, Archiving and IP Banning, record your current settings by printing them out. Some printers don�t fill out the check boxes when printing, so check your check boxes on your printouts for future reference.

Multiple Blog Suite is a set of scripts you can use to help back up your templates and configurations if you have many blogs.

Links:
MT Forum thread on backing up your weblog
Backing up your MySQL database
TypeMover - a plugin to help you backup, restore, and migrate your Movable Type weblog.
Creating Automatic Backups of your MT Database


Has this tutorial been helpful? Please consider linking to Learning Movable Type at http://learningmovabletype.com/ . Thanks!

Trackback

If you would like to send a trackback
please use the following URL: http://learningmovabletype.com/cgi-bin/mt32/mt-tb.cgi/294

» Backing up MySQL from Murky.org
Using Movable type, the site is based on a MySQL database, and it's important to back this up. Therefore I've put the following commands into crontab - I think they're okay (if anyone spots errors, please let me know!) The......[read more]

Tracked: September 6, 2004 11:47 AM

Comments

The MTWiki dump command isn't the best - if your MYSQL table gets too big it could start causing great strain on your server to dump and take even longer to download. A better dump command would be to tar gzip the file to do this add to the end of the MTWiki dump command with: | gzip -c > /path/to/backup/backup-mt.sql.gz

So the whole thing would look something similar to

mysqldump -h [name of the mysql server] -u [your username] -p[your password] [your database name]| gzip -c > /path/to/backup/backup-mt.sql.gz

The above will only work if your server supports it forgot to add sorry !

Arvind - really? I haven't had any problem with creating my dump file and it is over 2 MB. I just have it setup to run in the middle of the night. Downloading it takes 3 seconds.

Hehe 2MB its that big as yet ;) Its just a feature I thought I might share as we were talking about mysql dumps - I use it and much prefer it. My db is hitting approx 4-5 MB ;)

I recently found a wonderful script, Automatic MySQL Backup, that creates daily, weekly, and monthly backups in rotations. So you end up with no more than 7 daily, X weekly, Y monthly compressed backups. You can set X and Y. I run it nightly with cron and then another script backs up my backup directory to a separate server. Much piece of mind.

I saw Typemover yesterday at its chucking out a weird error. I've be en in email contact with the author to see wha tthe problem is. If it wrks it is an amazing plugin !

Hey Elise - just ended up here (yet again) on a Google search, and exactly what I wanted - shoulda come here first. Thanks, geekgirl...

I am about to both migrate from MT 2.61 to MT 3.11 AND change hosting. Now, what do you recommend that I do?

Option 1. Install MT 3.11 on the new host, export MySQL files from the old host, import them on the new host and cross my fingers...

Option 2. Upgrade MT 2.61 to MT 3.11 on the old host. Then use TypeMove to copy everything in the MT 3.11 installation on the new host. (Probably cross my fingers on this one as well).

My intuition says I should go for option 2, but I am a bit afraid (despite all the backups already done) of messing up with my original installation.

Besides, there's a couple of things I would like to change for the new installation, including naming convention for the individual archives.

Any/all opinions very much appreciated.

Julio - Personally I would go with option 1. Just don't turn off the old host until you have the new one running to your satisfaction. However, I am definitely NOT an expert in this. The best place to ask this question is at the MT Support Forums. You will get better informed suggestions there.

Has anyone been able to install Typemover in a Windows server?

I keep getting the following error message:

Loading template '../../plugins/TypeMover/tmpl/start.tmpl' failed: HTML::Template->new() : Cannot open included file plugin_header.tmpl : file not found. at c:\appserv\www\mt/extlib/HTML/Template.pm line 2024.

And below it says:

Use of uninitialized value in concatenation (.) or string at c:\appserv\www\mt/extlib/File/Spec/Win32.pm line 87.

How can I solve it?

Thanks!

This will get my DB - but what about my static files - search templates, etc?

Thanks for everything you do


Post a comment

(Before posting a comment please see the Comments and Trackbacks Policy. Do you need help troubleshooting your weblog? Please post questions and requests for support at the MT Support Forums. Thanks!)




Remember Me?

(you may use HTML tags for style)

Email to a friend

Email this article to:


Your email address:


Message (optional):