top | item 34608654

Ask HN: How do you backup your database?

8 points| janxgeist | 3 years ago | reply

We have a MariaDB database running on Debian VM (DigitalOcean droplet).

The database is at the core of our business.

But there has to be a better way to create automatic backups.

The way I currently do it is with cronjobs and scripts that move the transaction logs to another cloud provider (every xx minutes) and do a full backup every night.

Is this really the way to do this?

7 comments

order
[+] yawgmoth|3 years ago|reply
Debezium is a change data capture tool that can replicate changes to another target, such as a backup.

A common pattern with Postgres databases is to replicate the WAL to a read replica. If the primary goes down you promote the replica to master. I have to imagine there is a similar recipe for MariaDB.

[+] janxgeist|3 years ago|reply
I actually did set up replication to another database, several years ago. But at the time, for some reason the databases would de-sync to easily (often when changing the db scheme).
[+] brudgers|3 years ago|reply
But there has to be a better way to create automatic backups.

If the way you are doing it works, there isn't a better way.

So to me, the place to start is to make sure what you are doing is working (if you haven't).

I mean having one copy on another cloud provider isn't very deep.

As in only one cancelled credit card from failure (or maybe two).

Or two compromised credentials, at best.

Backing up either sucks or it isn't really backing up. It is not a good place to look for efficiency, because not backing up is always going to be easier than what you are doing.

Good luck.

[+] janxgeist|3 years ago|reply
I'm not so much looking for efficiency, but for simplicity. This contraption of scripts that get called by cronjobs, that then access some account on DigitalOcean etc. just seems to complex to me.

If I want to check if everything works, I have to check several places. My own documentation of this backup process is several pages long.

Considering how many people need to backup databases on linux, I was hoping there'd be a better, simpler practice.

[+] vxxzy|3 years ago|reply
Check out Percona XtraDB