How does the ETCD elector land with the combination?

Hello, everyone. Let me ask you a question

.

there is a Java service that starts 5 nodes to be highly available
requirement: only one service can be valid at a time
solution:
1 deploy ETCD campaign leader on each Java node
2 when all five nodes receive tasks at the same time, check whether the ETCD of their own nodes is leader, or return, otherwise reject
question:
is the above solution reasonable? If reasonable, how does the client know who the current leader is? If it is not reasonable, then how should it be better?

Feb.24,2022
Menu