blog

How to Backup Your Moodle Database

Sarojini Devi Nagappan

Published

Moodle is a popular learning management tool created for educators to build and manage online learning easily. The tool aims to provide a robust, secure, and integrated system to efficiently manage online education for educators and learners. This Learning Management System (LMS) tool has over 200 million users including academic and enterprise users, and the best news is offered free under the Open Source license. Anyone can download Moodle freely and customise it to develop a personalised online learning environment.

This blog gives you an overview of Moodle features, its current backup option as well as how to use automated backup management tools like Backup Ninja for a seamless backup and restore process.

Moodle Features Overview

Before we go any further, let’s briefly look at the features of Moodle. Firstly, although Moodle is an open source tool, it is continuously updated and has a new release once in six months. This merely is possible because Moodle is backed up by a large international community, an expert team of developers along with Moodle partners.

This LMS is a tool for both educators and learners; therefore, its features include content authoring and management, content delivery, and supporting teaching and learning activities. Moodle is popular among academia simply because the tool has a simple interface, drag-and-drop features, and well-documented resources, making it easy to learn and use. It’s also a web-based tool and can be accessed on any device, making it an excellent tool for any time and anywhere learning.

Moodle is architectured as a modular and platform independent tool. Developers can customise, develop, integrate external applications, or use the available free plugins to create specific features and required modules to fit their environment. Moodle constantly upgrades its security controls to safeguard its users’ data against any unauthorised users.

Moodle Backup Options

If you have Moodle as your LMS or CMS, it holds large amounts of data you can’t afford to lose. Therefore, having a backup and recovery strategy is crucial. Moodle system has three parts:

  • Database: At present Moodle works on MYSQL, PostgreSQL, Microsoft SQL Server, or Oracle
  • Uploaded files like course files and site files
  • Moodle code

To have a full backup of your moodle, you need to have a backup of all the three above.

Moodle Database

Moodle database backup methodology depends on the database used. You would need to check on the database technical manual to retrieve ways to perform backups. For example, if your Moodle has a MySQL database you could either use the phpMyAdmin tool or use the below steps to backup your Moodle database.

$ cd /my/backup/directory
$ mv moodle-database.sql.gz moodle-database-old.sql.gz
$ mysqldump -h example.com -u myusername --password=mypassword -C -Q -e --create-options mydatabasename > moodle-database.sql
$ gzip moodle-database.sql

Moodle Uploaded Files

Files and folders created and uploaded by users are stored in a directory called “moodledata”. This folder can be copied/backed up using any file transfer program like FTP, WinSCP.

Moodle Code

Like the files, you can use different file transfer and compression programs to backup the files to your preferred location. For further instructions on how to backup server files, you can check this link.

Automated Backup Management for Moodle

Creating and managing backups are tedious and time consuming. The previous section of this blog would have given an overview of Moodle backup management manually. While it is easy to manage moodle files and code backups, moodle database backup would still require a technical resource as it involves writing backup scripts. Manual backup management is resource-consuming and usually prone to errors, and its validity is highly questionable until it being restored.

To avoid any unpredictable situation during recovery, it is better to consider having automated backups tools and services as part of the backup and recovery strategy. Automated backup management tools give you the flexibility to schedule and consistently create backups making it a breeze for recovery to minimise downtime. Large amounts of Moodle data is in the database; therefore, the selected backup tool or service must backup and restore them on any of these databases MySQL, PostgreSQL, Microsoft SQL Server, or Oracle. Moodle is an open-source LMS, and works well with open source databases like MySQL and PostgreSQL, and backup tools like Backup Ninja, Veeam, Zmanda are good options to consider.

Moodle Database Backup with Backup Ninja

Backup Ninja is a web based backup service specially designed to backup open source databases like MySQL, PostgreSQL, MariaDB, and MongoDB without any manual backup scripts. It is built with features to schedule full, partial, and incremental backups in just a few steps. All you need to do is install the Backup Ninja agent on your database server using the easy to follow on screen guide.

Backup Ninja takes security seriously; it does not store any information on its server and protects your data movement with an advanced encryption algorithm. Backup Ninja also comes with the following features to keep your Moodle backup management a seamless process:

  • Have your PostgreSQL or MySQL backup stored locally or in the cloud
  • Backup Moodle server files using the same interface
  • Monitor the progress of the backup using a dynamic dashboard
  • Restore PostgreSQL or MySQL, and o test your selected backups

How to Backup and Monitor the Moodle Database Using Backup Ninja

You don’t have to be a technical expert to configure Backup Ninja on your server. In just a few minutes, you can have the service installed and schedule backups securely. You can follow the steps below to schedule automated backups using Backup Ninja.

Step 1: Get a Backup Ninja Account

Create your Backup Ninja account using this link. Backup Ninja offers two pricing options, one is a free plan, and the other is a business plan. The free plan is a great way to start your automated backup management process.

Step 2: Backup Ninja Agent Installation

The installation involves adding a server, installing the agent, and server discovery.

When you want to add your server to Backup Ninja, select the database technology you are using with Moodle on your server. Moodle uses PostgreSQL or MySQL open source database options and Backup Ninja supports both technologies in different versions.

Next, create the database user. You would need a privileged user like root or super admin to install the agent on the database server. Copy the commands displayed on the screen and execute them on your database server. Your server will be listed on the server page when it is successfully discovered.

Step 3: Schedule Moodle Database backup

To schedule a Moodle MySQL/PostgreSQL backup, click on add schedule, then follow the on screen instructions. Backup Ninja takes logical or physical backups for MySQL and PostgreSQL. Either way, both types of backups are taken using the same interface and steps.

The backup method is automatically listed according to the backup tool installed in the server. Check your server if you don’t see any listed in the backup method.

Next step is to decide where you would like to store your backup. You have an option to store your backup locally or in the cloud, or have it at both locations. In the last two steps, you can set the following parameters to complete the schedule:

  • Backup name
  • Compression
  • Encryption
  • Backup Schedule (the frequency on which you like to take backups)

Get the full step by step Backup Ninja scheduling instructions here.

Step 4: Monitor your Moodle Backup

Backup Ninja dashboard gives you a quick overview of the necessary metrics you need to have to understand the performance of your backup process.

Using the dashboard, you can understand your server’s status, backup statistics, upcoming backups, backup size, and backups due for deletion. This view can be customized according to your preferred timeline. Besides this, you will receive alerts and notifications on any backup events happening in your server.

Conclusion

The Covid-19 pandemic has made learning management tools like Moodle an essential tool for educational institutions or even enterprises facilitating teaching and learning. If Moodle is currently used as LMS / CMS in your organisation, then an automated backup service must be a part of your backup and recovery strategies. Moodle databases hold enormous amounts of data, and you definitely can’t afford to have data loss in case of any disaster. Tools like Backup Ninja not only helps you to schedule, create, and restore backups but also allows you to store backups on your preferred location and monitor them efficiently minimising downtime at all times.

Subscribe below to be notified of fresh posts