Skip to content

Multi-Database Sync

One of Walsync’s key advantages is efficiently syncing multiple SQLite databases from a single process.

Create a walsync.toml to define multiple databases:

[storage]
bucket = "my-bucket"
endpoint = "https://fly.storage.tigris.dev"
[[databases]]
path = "/data/users.db"
prefix = "users"
[[databases]]
path = "/data/orders.db"
prefix = "orders"
[[databases]]
path = "/data/analytics.db"
prefix = "analytics"

Then start watching all databases:

Terminal window
walsync watch --config walsync.toml

Walsync maintains a single:

  • S3 client with connection pooling for all uploads
  • File watcher that monitors all database WAL files
  • Configuration context loaded once at startup

Each database still gets:

  • Its own S3 prefix (namespace)
  • Independent WAL tracking
  • Separate checksum verification
  • Individual restore capability
┌─────────────────────────────────────┐
│ Walsync Process │
├─────────────────────────────────────┤
│ Shared S3 Client (~20MB) │
│ File Watcher (~5MB) │
│ ───────────────────────────── │
│ Database 1 state (~500KB) │
│ Database 2 state (~500KB) │
│ Database 3 state (~500KB) │
│ ... │
└─────────────────────────────────────┘

Adding more databases adds minimal overhead (~500KB-1MB each).

Each tenant gets their own SQLite database:

[[databases]]
path = "/data/tenants/acme.db"
prefix = "tenants/acme"
[[databases]]
path = "/data/tenants/globex.db"
prefix = "tenants/globex"

Each service manages its own database:

[[databases]]
path = "/data/auth.db"
prefix = "services/auth"
[[databases]]
path = "/data/billing.db"
prefix = "services/billing"

Containers or edge nodes with multiple databases:

[[databases]]
path = "/app/cache.db"
prefix = "edge/node-1/cache"
[[databases]]
path = "/app/sessions.db"
prefix = "edge/node-1/sessions"

Restore any single database without affecting others:

Terminal window
walsync restore --prefix orders -o /data/orders-restored.db

Or restore all databases:

Terminal window
walsync restore-all --config walsync.toml --output-dir /data/restored/