Site-level backups

So far, we have covered how to backup a single course. The site-level backup performs the same operation for every course in the system, including hidden courses and the front page, which is also a course (the name of the front page backup uses the name of the site).

Backup settings

To schedule site backups, go to Courses | Backups | Automated backup setup. You will see a number of settings:

Setting

Description

Active

Turns automatic backups on and off (default). Make sure that your backup is activated! You can further set the backup mode to Manual, which allows its execution via the CLI (refer to the command after this table).

Schedule

Specify the days of the week on which the backup has to run.

Execute at

Specify the time of the day that the backup is executed.

Automated backup storage

By default, all backups are stored in Course backup file area of each course. If you wish to keep all the backups in the same location, you have to select the specified directory for automated backups. It is also possible to save the backups in both locations (Course backup file area and specified directory). This will take up twice the storage. For the latter two options, you have to specify the Save to value.

Save to

Specify the full (absolute) path to the directory, and make sure that the access rights are set to writable.

Maximum number of backups kept

Specify the number of backups to be kept. Beware that a large number will have an impact on disk usage. Older versions will be deleted automatically.

Delete backups older than

Backups older than the specified number of days will be deleted automatically.

Minimum number of backups kept

Backups of older or inactive courses will be removed with the previous setting. To avoid this, specify the number of backups you wish to keep.

Use the course name in backup filename

Toggle that switches between the course ID and course name for the default backup filename.

Skip hidden courses

If selected, hidden courses will be excluded from the backup (default).

Skip courses not modified since

Select the number of days to exclude courses that have not be altered since.

Skip courses not modified since previous backup

If selected, only courses that have been changed since the previous backup will be included. This is the most disk space and time-efficient setting. Make sure logging is activated in order to support this mode.

The remainder of the settings page covers Automated backup settings that specifies which elements will be included in the backup. These are identical to the initial backup settings, except the anonymize option, which has been excluded.

For the backup to start automatically at the specified time, the cron process has to be set up correctly, which was covered in Chapter 2, The Moodle System. Alternatively, you can initiate the backup process via the CLI. The command execution from the shell or for the inclusion in scripts is as follows:

sudo –u <apache_user> /usr/bin/php admin/cli/automated_backups.php

The script has to be run as an Apache user, usually www-data. In the preceding example, it is executed from the main Moodle application directory. The script executes the same script that is called by the cron process.

The recovery of courses is identical to restoring data from course-level backup archives.

Backup reports and notifications

As a Moodle administrator, it is your duty to ensure that the backup execution has been successful. For this purpose, Moodle provides a backup report, which you can find by going to Reports | Backups.

Backup reports and notifications

The report provides details for each course being backed up, namely, Time taken (start and end time), Status (OK or ERROR), and the date and time of Next Backup.

Courses in which there hasn't been any activity for 30 days, that is, no changes have been made to the course content and no users have used the course, are excluded from the automated backup, and the status is shown as SKIPPED.

As a Moodle administrator, you will receive an e-mail after the execution of the scheduled site-level backup has been completed. It provides details on the total number of courses backed up and a split of how many course backups were okay, had an error, are unfinished, and were skipped. Make sure your e-mail settings have been configured properly (refer to Chapter 9, Moodle Configuration). It is highly recommended that you check the content of this e-mail every day.

The backup strategy

There are a number of issues to consider when running automatic site-wide Moodle backups:

  • Backup content: Make sure that everything included in the archives is needed and anything that is not required is excluded. For instance, do you have to back up the entire log file every night?
  • Backup size: The size of the backup files can be potentially huge (multiple gigabytes). Ensure that you only keep the number of backups that are required and your setup can cope with.
  • Backup timing: The backup operation is a CPU and hard disk-intensive operation. Make sure that you schedule it when the load on the site is relatively low. If you run multiple sites on the same server, it is a good idea to time-stagger the backups or create a script that makes of the described CLI. An alternative approach is to set up a separate webserver dedicated just to run the backups.
  • Backup frequency: Do you need seven daily backups or are weekly backups sufficient? Are there periods (such as weekends) when you can switch off the backup facility altogether?
  • Backup location: By default, all backup files are saved to the respective courses, which means that the backups are held on the same server as Moodle itself. If you have to recover multiple courses, you will have to locate each archive separately, which is potentially a very time consuming exercise.

You might want to consider backing up on an external device (tape, external disk, NAS drive, SAN, and so on). An alternative to this is to mount a backup device and include its content in the organization-wide backup.

Drawbacks of site-level backups

Site-level backups are a great way to automate course backups and make the lives of individual teachers and instructors easier. However, there are a number of drawbacks that should be stressed on:

  • Course backups are potentially very expensive in terms of time and CPU usage.
  • It is not uncommon for backups to time out, especially on commercially hosted systems that are not dedicated to Moodle.
  • If teachers and instructors run their own backups, there is a likelihood of duplication of archives, which should be avoided if possible.

As the name suggests, you only have to back up courses, not the entire system. While this is sufficient if you have to recover a simple course or a number of activities, it does not provide a solution to the scenario when the entire system has to be restored. You should not use the course backup facility as your sole backup system. Instead, system-level backups should be used as a supplement, which we will look at next.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.255.178