This month, we are glad to announce our latest feature: snapshotting 📸. It is now possible to create and restore Meilisearch from snapshots and schedule snapshot creation at custom intervals.

Thanks to this new functionality, you can export Meilisearch state to a compatible version and restore Meilisearch from a previous compatible state.

Snapshots

A snapshot is an exact copy of the database at the time the snapshot was created. Snapshots do not go through any processing.  

Creating snapshots

For Meilisearch to create snapshots, the feature must be enabled by specifying a path to the directory in which snapshots will be saved.

meilisearch --snapshot-path mySnapShots/ 
Meilisearch creates snapshots in mySnapShots folder

By default, Meilisearch schedules a snapshot creation every day. When the instance starts, it will wait 24 hours until the first snapshot. This means that if you have launched Meilisearch on Tuesday at 4 pm, the first snapshot will be created on Wednesday at 4 pm, and so on every day.

The schedule can be modified with the --snapshot-interval-sec flag.

meilisearch --snapshot-path mySnapShots/ --snapshot-interval-sec 3600
Now a snapshot will be created every hour.

During snapshot creation, snapshots are overwritten. Meaning, only the last snapshot will be present in the folder.

Start from snapshot

Because snapshots are zipped copies of your database that did not go through any processing, starting a Meilisearch instance from one of them is significantly faster.

Using the global environment MEILI_LOAD_FROM_SNAPSHOT or the CLI flag --load-from-snapshot , Meilisearch will start the server using the provided snapshot.

meilisearch --load-from-snapshot mySnapShots/data.ms.tar.gz

If a database already exists, or if no snapshot is found at the given path, Meilisearch will stop processing and throw an error.

To ignore either one of these errors, you can add the following flags: --ignore-missing-snapshot=true and/or --ignore-snapshot-if-db-exists=true

Use cases

Snapshots are safeguards in case of problems. If your Meilisearch instance encounters a problem or if you have done a mistake while manipulating your database, restarting your instance with the latest snapshot is an easy way to recover your data.

Version compatibilities

Since a snapshot is a replica of your database, it will restore it only if your Meilisearch runs on the version it has been created on.

Other changes

This release also fixes a couple of bugs and brings some improvements:
- Unwrap bug in the bucket sort that made Meilisearch panic
- Wrong case in the facet distribution
- Web interface enhancements

Contributions


Thank to @TaKO8Ki for his contribution this month.

We are eager to hear some feedback. Feel free to come and talk to us any way you prefer. We are thrilled by all the support given to our search engine and the never-ending growth in users and stars.

Thanks a lot,