litefs icon indicating copy to clipboard operation
litefs copied to clipboard

Working multiple clusters/hiding databases

Open clintonb opened this issue 11 months ago • 2 comments

I'm prototyping using LiteFS Cloud to distribute data retailers. Say we have Target and Sprouts. I only want the replica at Target to ever see target.db, and Sprouts should only see sprouts.db. If these databases are in the same cluster, they are replicated everywhere.

A logical solution is to use separate clusters. However, that means my central server that writes data to the primary needs to run multiple instances of LiteFS—one for each cluster.

  1. Is there built-in support for connecting to multiple clusters? I'd imagine something where each cluster might be it's own directory (e.g., litefs-target, litefs-sprouts).
  2. If not, any suggestions on making multiple cluster connections?
  3. It's not ideal, but I could get away with simply configuring LiteFS to only download a specific database. Any support for this?

clintonb avatar Sep 15 '23 07:09 clintonb

@clintonb That's not a feature we currently support but it's one that I would like to support. Do you need the ability to do auth for each database? For example, the consumer of target.db can only see that database because they pass some kind of auth token in?

Right now you'd need to set up a separate LiteFS cluster for each database if you want to isolate them. It's not ideal for sure.

benbjohnson avatar Sep 16 '23 18:09 benbjohnson

@benbjohnson ideally, yes the Target clients only see their own databases in a multi-tenant scenario.

I agree that separate clusters is the best path forward for now.

clintonb avatar Sep 16 '23 18:09 clintonb