Understand LiteFS Architecture components
mainLiteFS is composed of three primary components that enable asynchronous replication for SQLite databases:
- FUSE file system: Intercepts file system calls to record transactions. On the primary node, it intercepts write transactions transparently. On replica nodes, it prevents writes and provides information about the current primary via a
.primaryfile. - Leader election: Uses Consul sessions and a time-based lease system to ensure only one node acts as the primary at any given time. This is designed for ephemeral environments like Fly.io or Kubernetes.
- HTTP server: An API used by replica nodes to communicate with the primary node. Replicas provide their current transaction ID and a rolling checksum to request missing transaction data.