Backup and archiving

Raijin does not currently include a specialized tool for backing up databases. However, you can use OS-level tools to back up the Raijin Database Engine server.

File system snapshots

We recommend regular, full file system snapshots for large, active databases. The easiest way to implement this is by using OS-level tools to take a snapshot of the volume containing the Raijin data directory. This way, the full state of the database is saved, and in case of a catastrophic event, you can quickly restore service using the most recent snapshot.


  • During deployment, you must place the database on a volume that supports snapshots, for example, Btrfs or LVM. You can change the default Raijin data directory with the DataDir configuration parameter. See Storage settings for more information.

  • It is important that you stop the Raijin Database Engine service before taking the snapshot to ensure data consistency.

Example 1. Taking a snapshot

The first step is to lock the database to prevent further write transactions. The FLUSH TABLES WITH READ LOCK command locks all tables in all databases.

Lock the database from being modified
$ curl -X POST http://localhost:2500 -H 'Content-type: application/json' -d '{"query": "FLUSH TABLES WITH READ LOCK;"}'

Take a snapshot of the volume where the Raijin data directory resides and release the lock.

Release the database lock
$ curl -X POST http://localhost:2500 -H 'Content-type: application/json' -d '{"query": "UNLOCK TABLES;"}'

Finally, back up the volume snapshot to a safe location, ideally to an external storage device or service.