LiteFS -promote and -with-halt-lock-on without Consul

Hello there!

Very excited to start using LifeFS! I missed the announcement that it was ready to use so I’m late to the party. :partying_face:

One of the applications I wish to convert over to LifeFS runs outside of Fly.io and the nodes don’t have network connectivity, so I can’t use Consul to dynamically determine the leader.
The majority of the time one node is the leader, but once a day a node elsewhere comes online and performs a small number of inserts before shutting down.

litefs run -with-halt-lock-on seems like it would be a way to manage this. Does this work without Consul? The requirement wasn’t mentioned in these docs, but these docs made me think Consul would be required.

Alternatively, are there other ways for a node to briefly lock the cluster to perform writes?

Thanks,
Louis

Hi @lpil

Halt lock doesn’t need Consul to work. A node that wants to acquire the halt lock just needs to be able to talk to current LiteFS primary over HTTP.

Note that litefs run -with-halt-lock-on <DB> doesn’t run LiteFS itself and work over already running LiteFS which, presumably, can talk to the primary.

Alternatively, are there other ways for a node to briefly lock the cluster to perform writes?

AFAIK, it’s the only way with static leases. With Consul, a node can request handoff and promote itself to primary. But this is not supported with static leases.

1 Like

Got it, thank you. So without network connectivity between the two nodes there’s no way for the non-master node to perform a write. Is that correct? Sounds pretty obvious when said out loud :grin:

Does LifeFS always require network connectivity between nodes?

Is it safe to expose LifeFS nodes on the public internet or should they be on a private network?

Does LifeFS always require network connectivity between nodes?

If there is no network connectivity between a replica and a primary, the replica will continue to work, AFAIK, but with potentially stale data.

Is it safe to expose LifeFS nodes on the public internet or should they be on a private network?

No. There is no auth between the nodes.

Ah right! So changes are sent from the primary to the replicas? I had got it confused with litestream and thought it was syncing via S3 or some other storage.

And only the primary connects to LiteFS Cloud, is that right?

And only the primary connects to LiteFS Cloud, is that right?

Yeah, that’s right.

Now re-reading your origin post, when you said that nodes don’t have network connectivity, did you mean between each other, or to the Internet in general (and LiteFS Cloud specifically)?

They both have access to the internet, and they’re on separate private networks and cannot connect to each other.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.