Backing up a database
In terms of most common databases, such as MySQL and PostgreSQL, there are at least two different ways to back up a database:
- Take a database dump by extracting all current data, along with the database schema
- Copy replication logs
In cloud environments, you can also take a snapshot of the disk database where the backup is being saved.
A database dump can also be used as a full backup. Replication logs aren’t self-sufficient database dumps, so you will need to combine them with a full backup. This is called an incremental backup.
Doing a full backup can take a long time, especially for big databases. While it’s running, the database puts a lock on its data files, so it doesn’t save new data on the disk; instead, it stores everything in the replication logs until the database lock is released. For large databases, this operation can take hours. Because of that, we will be creating a full backup once a week and copying...