Your Cloud Backup Won’t Save You: Independent MariaDB Backups with Databasus

MariaDB sea lion safe on a life ring holding a sealed case while a storm cloud breaks apart, with the title Your Cloud Backup Won't Save You

Then run docker compose up -d and open http://<your-server>:4005 in your browser. You’ll see the sign-up screen:

In most cases, the best choice is the “GFS” strategy: keep daily backups for the last 7 days, 4 weekly backups and 12 monthly ones. You get fine enough granularity without using too much space.

First, though, the backup basics that matter no matter which tool you use.

What backups are for

If you work alone, you can disable sign-up after creating your account. If you have a team, you can run several separate teams, each with access only to its own databases. Audit logs show who changed what and who downloaded which backups.

It is a popular open source backup project on GitHub, and MariaDB is one of its focus databases. That is why it’s in our catalog.

Infrastructure emergency is when the whole server or cloud hosting your database disappears. Your AWS account gets blocked by mistake, or your data center loses power. You can’t wait days for the infrastructure to come back. You need an independent copy you can restore somewhere else.

Install Databasus on your server. The usual way is Docker Compose (for other options, like an install script or Helm, see the installation docs):

Managed DBs or only self-hosted?

Choose how you want to hear about failures.

Here’s how to set it up.

  • self-hosted, on a virtual machine, bare metal server or Kubernetes;
  • managed, in MariaDB Cloud or AWS/GCP managed databases.

Your cloud provider has backups. Your provider can also go dark for hours, lock your account by mistake, or lose a whole region. When that happens, the backups go dark with it.

When you self-host, you are the only one responsible for the DB, backups included.

That is why we recently added Databasus to MariaDB EcoHub. Databasus is an open source tool for scheduled MariaDB backups to S3 and many other storages. This article shows how to set it up.

Data corruption is when someone ran a harmful query, there was an SQL injection, or a migration went wrong. You need to look at an earlier state of the database, take some data from it and fix the current DB without a full restore.

Backups usually serve one of two goals: rolling back after data corruption, or recovering after an infrastructure emergency.

What to keep in mind when making backups

That’s it. Your backups are running.

Remember the rule from earlier: a backup you’ve never restored is a backup you can’t trust. Once your first backup finishes, restore it into an empty database and check the data. Then write down the steps. That’s your runbook.

So it’s always worth having an independent backup outside of it. Better to never need it than to need it and not have it. It’s usually cheap, too.

  • keeping backups on the same virtual machine as the DB;
  • keeping backups in the same region as the DB (like an EC2 VM and a managed DB both in us-west-1). If the region goes down, the backups go down with the DB;
  • keeping backups in only one cloud. Keep a second copy in another cloud, or at least on your own machine.

Then pick where to send backups. Usually that’s S3, but you can also store them locally, via FTP, on a NAS and more. See the full list of supported storages.

Find Databasus in MariaDB EcoHub and on GitHub.

How Databasus helps

Keep these two cases in mind as we look at how and why to make backups.

If your DB isn’t publicly accessible, you can connect through an SSH tunnel.

Test your restores. A backup that has never been restored is not proven to work.

1. Install Databasus

services:
databasus:
container_name: databasus
image: databasus/databasus:latest
ports:
- "4005:4005"
volumes:
- ./databasus-data:/databasus-data
restart: unless-stopped

To restore, click “Restore” or just download the backup. Databasus can restore it into an empty DB:

A managed DB usually has backups built in. But you still depend on the cloud. Its backups protect you from data corruption as long as you can reach the cloud and create a new DB from them.

Databasus sign-up screen

There are 2 ways to run MariaDB:

2. Add the database

Backups sometimes fail, and you need to know when they do: the DB is unreachable, the network drops, and so on. Databasus can notify you via email, Slack, Discord or other channels after a couple of consecutive failures.

When the whole cloud has issues, and major providers have had large outages in recent years, you can only wait. Account blocks, freezes, human error and legal issues can also cut you off from your DB. Cloud backups are stuck inside the cloud.

Bad patterns, for example:

Database connection settings

3. Configure the schedule and storage

You need the address, DB name and credentials. Databasus will suggest creating a read-only user for backups, since it doesn’t need write access or anything higher.

Backups should exist. Keep at least some backups. That’s step one.

Backup schedule and storage settings

4. Set up notifications

Both.

Adding a notifier

In both cases, backups are ultimately your responsibility.

Test them regularly. Without a written runbook for emergencies, you may find out too late that you can’t recover at all.

List of completed backups

5. Restore when needed

Databasus is an open source tool that runs backups on a schedule. You tell it which DB to back up, where to store backups (S3, FTP, NAS, etc.) and how often (hourly, daily, custom schedule, etc.).

Restoring from a backup

Before you close this tab

Keep backups independent of the DB’s infrastructure. Don’t store backups next to your primary DB: if that infrastructure goes down, your backups can become unreachable too.

Create a workspace and add your database to it.

Similar Posts