Switchover in ectd election API #14716
Unanswered
MatteoGioioso
asked this question in
Q&A
Replies: 1 comment 5 replies
-
You can use Btw I am writing a leader election client based on etcd that would provide a switchover out of the box. Check this out. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am writing a HA solution for a database and I am using the go client election API: https://pkg.go.dev/go.etcd.io/etcd/client/v3/concurrency#Election
This is the pseudo-go-code of what I have at the moment:
This works fine, if I start multiple processes of the same application and stop the leader, another one will be elected automatically.
Now I would like to add the possibility of switchover. They idea would be to add an endpoint and send the id of the instance I want to promote.
The client election API contains a method called
Proclaim
, which I think it does what I need, however it just change the value of the leader key.There is also another method
ResumeElection
, the signature seems to suggest that I can assign an arbitrary leader key, however is not explained how it works and also it may require all the applications to recreate a session or a new election object which sounds quite cumbersome.Is there anything I am missing? Is there a simple way to promote a specific replica to leader?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions