superfly / litefs

FUSE-based file system for replicating SQLite databases across a cluster of machines
Apache License 2.0
3.95k stars 95 forks source link

Filter replicated databases #407

Closed benbjohnson closed 1 year ago

benbjohnson commented 1 year ago

As discussed in this Community forum post, this PR adds a config option to specify a subset of databases to be replicated to a specific replica. Please note that this config option is only allowed on non-candidate nodes! If we allowed it on candidate nodes then it would delete the other databases when the node became primary.

Usage

To use the filter, specify it with the lease.databases config field:

lease:
  candidate: false  # Must not be a candidate, otherwise will error out on startup
  databases: ["foo.db", "bar.db"]

or you can use the multiline array format:

lease:
  databases: 
    - "foo.db"
    - "bar.db"