Lullabot Module Monday: Backup and Migrate

Video loading...

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

Lullabot Module Monday: Backup and Migrate

Loading...

In this Lullabot Module Monday lesson we take a look at the Backup and Migrate module. Few things are more terrifying than the realization that a server hiccup has wiped out a web site, or a hasty change deployed to the live site has nuked important content. Fortunately, there's a module that can help. Backup and Migrate offers site builders a host of options for manually and automatically backing up their sites' databases, and integrates with third-party backup services, to boot!