Lullabot Module Monday: Backup and Migrate
0 (0 Likes / 0 Dislikes)
[♪ Music ♪] [Drupalize.Me] [Learn Drupal]
[Backup and Migrate] [Lullabot Module Monday with Kyle Hofmeyer]
The Backup and Migrate module is not just a great module,
but it's a fantastic tool to have in your arsenal.
It basically can give you lots of different functionalities
that you can choose how you want to use it, but obviously,
its most important thing is backup.
But it's not just about backup, though.
You can use it to get database snapshots to pass around
if you're working in different environments and you want to make sure
everyone is working on the exact same database.
You can use Backup and Migrate to quickly export your database
into a zip file and pass it on.
But basically, Backup and Migrate also gives you the option to do things
such as back up your database to different locations,
to email.
You can manually do a backup.
You can also put it to Amazon S3 servers.
You can do lots of things with Backup and Migrate, so let's take a look
at this fantastic module.
I have a quick, easy site here.
I've already installed Backup and Migrate,
and where you'll find its configurations is obviously in the Configuration tab.
Inside the Configuration tab, we now have Backup and Migrate.
Now, one thing you're going to notice right when you install it
if you're on a nice, fresh site, or if your site isn't 100% fully configured,
the first thing it wants you to do is set your file system settings.
Let's go ahead and do that, and I'm going to set my
private file path, because that's where we're going to want to store things.
Let's go ahead and save that configuration.
All right, now let's go back to Configuration, Backup and Migrate.
Now let's go to the interface and what we can do with Backup and Migrate.
We've got several tabs up here for backing up, restoring, different destinations.
You can have profiles, and also you can schedule Backup and Migrate,
which is a great thing, so you can make sure that you have
your database site being backed up once a day,
once an hour, however you want to set it.
On the first tab for Backup, we have a quick backup.
Here's where you can hurry up and say, "Holy cow, let's get it backed up."
This is where you can download it, and if you need a file
to pass on to another person, or if you're taking it from maybe
your production site to make sure your development site's database is--
just what's in the production.
Here you can set that, and you can choose whether or not you want the default database.
Now, we can add some different things in here, and we'll cover that later.
You can choose to download it or put it in the manual backups directory,
which is a directory that we set in our private file system.
And then we can use the default, so these are the most basic settings
for a quick backup.
Now, for an advanced backup,
we get quite a few more options of things you might want to do.
Let's take a look at those.
In the advanced backup section, we've got some other options
for changing the backup file's name, and you can use replacement patterns.
We can change time stamps, what type of compression we want.
Another thing, the Backup and Migrate module will also work with
the AES Encryption module if you want your backups to be encrypted,
so that's pretty handy.
Another thing you can do is change the database backup options.
Here's where you can actually exclude certain tables.
When you make your backups, you can also choose tables,
so you can get rid of things like the cache table and the watchdog.
Those are things that you probably don't really need in a backup,
and it makes your backup smaller and makes things go quicker.
If you're scheduling backups or if you quickly need a snapshot
of your site, you can choose to exclude certain things.
You can also choose what destinations you want.
You can create destinations, and then you can also save these settings
so next time you come here, it will be set up just that way.
That is the Backup and Migrate the advanced backup settings.
Now, you can also restore.
Obviously, if you have a backup, and let's say you are doing something
even in production or something and something went wonky,
well, now you can restore, so if you're doing a schedule
you can restore from there.
If you know that you're getting things on an hourly basis,
go get the most recent one.
Quickly restore it.
You can choose files to restore, so here's where it works handy
if you did a quick manual download, and then you're in a different location.
You can now just choose that file.
That's where you can do your restoring.
There are some advanced options in here where if you are on a live site,
you can take the site offline when you're doing restoring.
That's in the restoring, and then in the destinations
it comes predefined with a manual backup,
a scheduled backup directory, and a default database,
so you can set these where you want them.
As I created my private directory, it now made a backup_migrate/manual,
backup_migrate/scheduled.
When you set those, this is where they will go.
When you're trying to find them, you can see what files are in them.
If you have multiple files that you have created,
they will all be in there.
And then finally, we've got Profiles.
Profiles basically allow us to change in that advanced setting.
You have different ones, so if you want one that has the watchdog table
and one that doesn't have the watchdog table, you can create different profiles,
and then when you do your backup you can choose which profile you choose to use.
But since we don't really need to create one, let's just cancel out of this,
and now let's look at scheduling.
We can now add a schedule
and we can maybe even call this--you can create a monthly schedule,
a daily schedule, a weekly schedule.
You can choose which profile, so if you want
your monthlies to have the watchdog, you might want to look at that one
happen over the month, but dailies maybe you don't want it.
You can choose different profiles.
You can tell it how many backups you want it to keep
and how often you want it backed up.
If I'm doing a monthly, I could say once every four weeks,
and then I can say let's only keep one of those.
I'll have one backup file per month.
And then you can also choose where this goes, so let's say you want your monthlies
to push to a different destination than your dailies.
You might want your dailies to be pushed offsite,
and you might want your monthlies to be put in a special directory.
You've got a lot of power that you can do here,
and let's go ahead and see what it looks like to create a new destination.
Here's where you have a few options.
One thing I want to show while this is loading,
let's go ahead and look at the Backup and Migrate.
There's other modules that work with Backup and Migrate,
and a lot of them also give you some cool stuff,
like you can use Backup and Migrate SFTPs
if you want it to go to an SFTP site,
if you want it to go into your Dropbox or the HPCloud.
Out of the box, though, Backup and Migrate will allow us to--
let's add a destination--go to an FTP directory.
You can import backup directly into another database
in an Amazon S3 bucket, or you can have it done by email.
These are the defaults.
Some other helper modules will give you some more options.
Another helper module is Backup and Migrate Files.
If you want to make--it's great that we have our database,
but user-generated content could have photos and uploads,
and we might want that, because we can't lose that if something goes bad with our site.
With the Backup and Migrate Files module,
you can also backup your file's directory to wherever you need it to.
I know that Backup and Migrate the next version is actually going to include that
right in it, so you won't need the other helper module,
but I just wanted to mention it now so you know it does exist.
And basically, that's Backup and Migrate.
Every site you start you probably should have it.
It's a tool that's helpful for development.
It's a security tool, so if you're working with sites
and things happen on servers, because things can happen every day,
I highly recommend the Backup and Migrate module,
and there we have it.
[Drupalize.Me] [Learn Drupal]