Skip to content

Implement static lease#47

Merged
benbjohnson merged 1 commit intomainfrom
static-lease
Aug 11, 2022
Merged

Implement static lease#47
benbjohnson merged 1 commit intomainfrom
static-lease

Conversation

@benbjohnson
Copy link
Collaborator

This adds support for a fixed primary node so that Consul does not need to be used. It will not support handoff of the primary so the cluster will be read-only when the primary stops.

Original PR: jwhear#2

Fixes #37

Usage

Specify the static block in your configuration instead of consul. You cannot specify both blocks.

Primary node

static:
  primary: true
  primary-url: "http://myhost:20202"

Replica nodes

static:
  primary: false
  primary-url: "http://myhost:20202"

This adds support for a fixed primary node so that Consul does not need
to be used. It will not support handoff of the primary so the cluster will
be read-only when the primary stops.
@benbjohnson
Copy link
Collaborator Author

@jwhear I reworked your Fixed Leader PR a bit. I changed the name to "static" instead of "fixed", I removed the UUID & HTTP call in the leaser, and I added a test to verify.

@benbjohnson benbjohnson merged commit db1ff10 into main Aug 11, 2022
@benbjohnson benbjohnson deleted the static-lease branch August 11, 2022 19:32
@benbjohnson
Copy link
Collaborator Author

@jwhear Hmm, it like it's still not showing attribution. Do you have your email hidden or are you using a different email address than the gmail.com one that's on your commit? It doesn't look like it's linking your name to your GitHub account either on the UI.

@jwhear
Copy link
Contributor

jwhear commented Aug 11, 2022

Looks like I had a different email on file with Github; I've added the one used in my commits.

@jwhear
Copy link
Contributor

jwhear commented Aug 11, 2022

Also, regarding the UUID business: I went back and forth on whether to use a config value or do self-discovery and ended up with the self-discovery because it meant that my config file could be the same for all nodes. Not a big deal either way though. Might be good to allow setting primary: true via an environment variable as well.

@benbjohnson
Copy link
Collaborator Author

That makes sense. LiteFS will evaluate environment variables in the config so you can do: primary: ${IS_PRIMARY}

@benbjohnson benbjohnson added this to the v0.2.0 milestone Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fixed Leader

2 participants