News for hackers. Stuff that matters.

Ask HN: How do you backup your database?

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 | 2 points | on HN )
Re:Ask HN: How do you backup your database? by buildint on Wednesday February 01, 2023 @05:36AM (#34608777)
Start by considering what are your RTO and RPO requirements are. Then design your backup solution to achieve that.

How many transactions are you doing on the DB? What's writing to it?

How big is the DB? https://mariadb.org/cyber-protection-best-practices/

Re:Ask HN: How do you backup your database? by vxxzy on Wednesday February 01, 2023 @07:10AM (#34609414)
Check out Percona XtraDB
Re:Ask HN: How do you backup your database? by yawgmoth on Wednesday February 01, 2023 @08:35AM (#34610159)
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.

Re:Ask HN: How do you backup your database? by janxgeist on Thursday February 02, 2023 @03:21AM (#34623736)
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).
Re:Ask HN: How do you backup your database? by brudgers on Wednesday February 01, 2023 @10:01AM (#34611368)
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.

Re:Ask HN: How do you backup your database? by janxgeist on Thursday February 02, 2023 @03:19AM (#34623721)
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.

Re:Ask HN: How do you backup your database? by brudgers on Thursday February 02, 2023 @10:35AM (#34627975)
* * *