litestream
Streaming replication for SQLite.
Litestream is a background tool that continuously backs up a SQLite database to Amazon S3 or another location as changes happen, so a server crash never causes data loss without changing your application code.
Litestream is a tool that automatically backs up a SQLite database by continuously copying changes to another location as they happen. SQLite is a popular database format that stores all its data in a single file on disk. The problem with SQLite in production is that if your server crashes or loses data, you can lose everything since the last manual backup. Litestream solves that by running quietly in the background and streaming every change to a safe destination, such as Amazon S3 or another file location.
The tool runs as a separate background process rather than sitting inside your application. It talks to SQLite through the official SQLite programming interface, which means it cannot corrupt your database even if something goes wrong. It only handles disaster recovery, not general database management.
Setup and documentation are hosted on the Litestream website rather than in this repository, which keeps the README brief. The project is currently in beta status. It is written in Go and released under an open-source license. Contributors have helped add support for running it on Kubernetes and on OpenBSD in addition to more common server environments.
Where it fits
- Run Litestream as a background process to stream all SQLite changes to Amazon S3 for automatic disaster recovery.
- Deploy a SQLite-backed web app to production with continuous backup without touching any application code.
- Restore a SQLite database from the continuous backup stream after a server crash or data loss event.
- Run Litestream inside a Kubernetes pod alongside a SQLite-backed service for cloud-native backup.