[erlang-questions] leader election ?

Thomas Elsgaard thomas.elsgaard@REDACTED
Fri Oct 19 10:14:07 CEST 2018


Hi Dmitry

Yeah no fancy cloud, just plain "old school" servers in two datacenters.

I could add a third server, that is not an issue. My main concern is to
find a reliable solution without too many dependencies or moving parts.

In a weak moment i considered to do some pessimistic locking in a MongoDB
replica set. But i am worried for strange scenarios which I haven’t thought
about.

Thomas






On Fri, 19 Oct 2018 at 09:25 Dmitry Kolesnikov <dmkolesnikov@REDACTED>
wrote:

> Hello,
>
> Fasters and easiest way to run a 3rd party service that would handle
> election/arbitration. However, that option does not give you any
> engineering challenge =).
>
> Unfortunately, you said nothing about your environment. I suspect that
> separate datacenter does not mean AWS availability zones. The biggest
> challenge to solve is splits. It is not recommended to run Erlang cluster
> accross data centres therefore majority or Erlang build-in solutions would
> not help you. Most of Erlang libraries relies on Erlang distribution.
>
> It is a challenge to build a consensus if you have only 2 nodes, it is
> impossible to make a quorum. Therefore, you need arbiter anyway. Once, I
> was “lazy” to setup zookeeper for arbitration purposes then my simplest
> path was in-memory mnesia + simple REST API but it was way long ago before
> consul.
>
> If you can tolerate last-write-wins that you might do nothing =)
>
> Best Regards,
> Dmitry
>
> > On 19 Oct 2018, at 7.38, Thomas Elsgaard <thomas.elsgaard@REDACTED>
> wrote:
> >
> > Hi list!
> >
> > I am running 2 instances of an application ( seperate datacenters), both
> receives indentical data on TCP sockets, but only one of the applications
> should process it further downstream.
> >
> > Any suggestions to what is the "simplest" way to have a kind of leader
> election ? Both applications must be running, but must have knowledge about
> their own role (active or passive) in order to decide if the data should be
> processed downstream.
> >
> > Should I use an external application like consul or etcd to implement
> leader election, or is there an better way via OTP or libraries ?
> >
> > It just seems a little "heavy" to use consul or etcd to elect an leader
> between two application instances.
> >
> > Thomas
> >
> >
> >
> >
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20181019/e76b4d9a/attachment.htm>


More information about the erlang-questions mailing list