Closed benbjohnson closed 1 year ago
I have given this some thought as my proposed system design using LiteFS would prefer a primary located centrally (at least from a latency perspective) in the US, with replica nodes all over the place. The approaches that I seriously considered:
is-primary-eligible: bool
) that determines whether a particular instance is allowed to become the primary using the existing Consul system. In my case, I might run three nodes in Kansas which are primary eligible and then have all the rest of my nodes be ineligible. That way if my primary does go down, I have two machines with similar characteristics who could take over. I think the implementation might be as simple as checking a config option before attempting to acquire the primary lease in acquireLeaseOrPrimaryURL.Just saw #16, looks like you already have point 2 in mind.
Currently, LiteFS uses Consul for leader election but it could be useful to have a single, fixed leader that replicates out to read-only replicas.