Backup & Recovery for Your Drupal Database

Backup & Recovery for Your Drupal Database

Profile picture for user sarojini
Sarojini Devi Nagappan
13 October 2020

Drupal is a popular open-source content management system (CMS) used by different types of industries. It serves as a foundation for millions of websites including personal blogs, government websites, and large scale e-commerce sites. Operating under an open source license, Drupal allows excellent flexibility and scalability without the fear of vendor lock-in situations. Developers are free to download Drupal and customize it with any features to meet their requirements.

Drupal CMS comes with a user-friendly interface, allowing users to create content using thousands of modules contributed by other developers. Also, this CMS is bundled with a user management module enabling only authorised users to access, create, and maintain contents. The core download not only comes with many technical feature modules but, it includes creative templates, filters, photo gallery, polls to spin up a feature-rich and attractive website.

Drupal uses an object-oriented methodology, PHP framework, and many web standards, making it easier for developers to develop fully functional web systems in a shorter time. With a large community, developers get to access new or enhanced modules contributed by other fellow developers effortlessly. 

This blog looks at methods for backing up Drupal sites using one of its modules and alternative tool, Backup Ninja.

Databases for Drupal

Drupal stores its web content in databases. MySQL 5.5.3, MariaDB 5.5.20, and Percona Server 5.5.8 or higher with InnoDB as their primary storage engines are the recommended database servers. Drupal is also able to store data with database servers like PostgreSQL and MongoDB but some modules could not work fine using it, so you need to check the official documentation to verify that.

Drupal Backup and Recovery

As mentioned earlier, Drupal serves as a content management server for many small and large organizations websites; therefore, it stores and manages large volumes of data critical to the business. Hence, having a backup and recovery strategy is necessary to prevent any type of disaster affecting the availability of the website. In Drupal, the backup and restoration can be handled by the Backup and Migrate module. This module allows you to schedule, create, and restore database backups. Also, it simplifies the task to copy a database from a Drupal site to another one. The module creates a dump of all or partial files or tables to a file and stores them on the server for restoration. Steps to use this module are relatively simple, but it requires a superuser role to configure and manage the backups. 

Install and Configure Drupal Backup and Migrate Module

To use this module, you need first to install the Backup and Migrate module from the Administration panel. Click on Backup Now button to download, and you will have a backup copy stored on the Drupal private directory.

Install and Configure Drupal Backup and Migrate Module

Create a Drupal Backup Directory 

You need to have a private Drupal directory outside the Drupal installation which is not accessible via the web to store the backups. The backup directory needs to be set up before the backup task. Check the following steps listed by  Drupal to create a private backup directory for your drupal backups.

  1. Navigate to Configuration > File system (or Administration > Configuration > Media > File system) to confirm that the settings are correct.
  2. Navigate to Configuration > Performance (or Administration > Configuration > Development > Performance) and click Clear all caches so the file streams are updated.
  3. Navigate to Configuration > Development > Backup and Migrate > Settings > Destinations. Click Edit to edit the Private files directory destination, or create a new destination. Enter the directory you want to use for backups, such as private://backup_migrate (if it is within the private file system), or the full path to the directory you want to use and save.

Schedule Drupal Backups 

Go to the schedules tab on the backup and migrate module and enable it. This will allow you to create backup schedules on the desired frequency with the number of days to retain it.

Restore Drupal Backups

To restore the partial or full backup click on the saved backups tabs, and you will get a list of saved backups here. Click on the restore button to start the restoration. It is always good to restore processes with someone who has technical skills on database technology.

Backup Drupal Databases with Backup Ninja.

In the earlier section of the blog, you have seen how to use the Backup and Migrate module to schedule and take backup. You can also connect to a cloud provider like AWS to schedule and backup Drupal databases on the cloud, so you can have data stored on multiple data centers in different regions to prevent data from any kind of threats. With this approach, you would need to maintain and monitor two separate backup systems, one on the cloud and one locally on your server. 

Alternatively, you can use backup services like Backup Ninja, which allows you to take backups and store them locally and in the cloud using the same interface. Backup Ninja’s web interface is simple to navigate, and you don’t need a highly technical resource to manage your backup. Following are the key features of Backup Ninja:

  • Allows you to take script-less backups for leading open source databases like MySQL, MariaDB, Percona, PostgreSQL, TimeScaleDB, and MongoDB
  • Schedule incremental, partial, and full backups locally and in the cloud using the same interface in just four simple steps
  • Highly secured, uses advanced encryption algorithms to ensure your in-transit and rest data is always safe for security threats
  • Interactive dashboards giving you insights on various backup management metrics
  • Keeps you updated with on any backup events or backup agent events via email
  • Integrated with a leading and affordable cloud providers for scalable object storage with geographically distributed data centers

Scheduling Drupal Database Backup on Multiple Storage with Backup Ninja

Installing Backup Ninja agent will be your first step to schedule any automated backups on Backup Ninja. Once you have successfully installed the agent, your server will be listed as the host on the server. Upcoming steps will show you how to schedule backups for a MySQL database server both locally and on the cloud.

Step 1: Complete the schedule details.

Give a name for the backup schedule and select the server you want to backup. The backup method will list the backup tools installed in the server automatically. Backup type allows you to choose either it is a full or partial backup type.

Scheduling Drupal Database Backup on Multiple Storage with Backup Ninja

Step 2: Configure the backup storage.

Next select where you would like to store the backup. You can have a combination of local and cloud storage configured on the same screen. If you would like to add more storage locations, simply click on the 

+ Add New Storage and fill in the next storage location. Retention here is the duration of how long you would want to keep the backup.

Scheduling Drupal Database Backup on Multiple Storage with Backup Ninja

Step 3: Backup name, compression, and encryption setting

Give a name to your backup, or you can choose to leave it at the default setting. If you are concerned about the backup size, enable the compression toggle and the backup will be compressed using the gzip compression. You can also enable the encryption to have encrypted backups.

Scheduling Drupal Database Backup on Multiple Storage with Backup Ninja

Step 4: Set the backup frequency.

The last step is to set the frequency of the backup task, and the backups will be scheduled to run according to the database server settings.

Scheduling Drupal Database Backup on Multiple Storage with Backup Ninja

View the created schedule on the scheduled listing. Click on the play button to start or pause the schedule. The storage shows you the two storage locations for the backup.

Scheduling Drupal Database Backup on Multiple Storage with Backup Ninja

Conclusion

Having a good backup and recovery strategy for Drupal sites is mandatory. If your Drupal site manages a large amount of traffic and data transactions, then you can’t afford to have timely Drupal database backups. Having no backups or outdated backups leads to slower recovery time and which increases the downtime leaving dissatisfied customers. Therefore it is essential to manage the backups in an automated way. While Drupal has a good backup and migration module to simplify the backup task, you would still need another solution for cloud backups, and this means you have two different backup management tools. Alternatively, you can always invest in independent backup services like Backup Ninja to offer you automated backups services for centralised backup management securely and straightforwardly.