Ben Johnson, the author of the NoSQL storage BoltDB, introduced the Litestream project, which provides an extension for organizing data replication in SQLite. Litestream requires no changes to SQLite and can work with any applications that utilize this library. Replication is handled by a separately executed background process that tracks changes in the database files and transfers them to another file or external storage. The project code is written in Go and is distributed under the Apache 2.0 license.
All interactions with the database are conducted through the standard SQLite API, meaning that Litestream does not interfere directly with operations, does not affect performance, and cannot corrupt the database contents, which distinguishes Litestream from solutions like Rqlite and Dqlite. Changes are tracked by enabling the Write-Ahead Log (WAL) in SQLite. To save storage space, the system periodically aggregates the stream of changes into snapshots of the database, on top of which other changes begin to accumulate. The timing of snapshot creation is configurable; for example, snapshots can be generated once a day or once an hour.
The main applications of Litestream include organizing secure backups and distributing read load across multiple servers. It supports transferring the stream of changes to Amazon S3, Azure Blob Storage, Backblaze B2, DigitalOcean Spaces, Scaleway Object Storage, Google Cloud Storage, Linode Object Storage, or to any external host that supports the SFTP protocol. In case of corruption of the main database contents, a backup can be restored from a state corresponding to a specified point in time, a specific change, the most recent change, or a designated snapshot.
Source: opennet.ru
