[erlang-questions] Distributed application and netsplit
Thu Nov 20 21:09:55 CET 2014
I've waited for someone to jump in and say this, but it hasn't happened.
You really, really don't want to try dealing with netsplits and application
failover in an app specific manner. It is not safe, and you will likely
lose data. You really need a consensus algorithm like raft or paxos to
handle this type of thing safely, or else you will end up with conflicting
data on both sides of the partition.
It may be quite a large dependency to rely on, but riak 2.0 has strongly
consistent keys that you could use to build a lock server to point to
the active master server. Alternatively you could use riak_ensemble
directly to build a custom solution.
Lastly, you can simply choose to not use failover and accept that when the
primary goes down you will be offline until it comes back up. The secondary
is just there to provide disaster recovery in case the primary is
irrecoverable. This is a much safer and simpler solution, and one
historically used by conventional databases with both asynchronous and
synchronous replication. If you must have some level of fault tolerance/ HA
you can use paxos. If your application can handle eventual consistency and
the data types fit the model, you could try to use CRDTs . That would
allow you 100% availability and even allow writes to happen to both servers
I can't stress enough how important it is to not build ad-hoc failover
protocols for this purpose. It will bite you. I've been bitten before, and
so have many other people relying on this mechanism. While it may seem
easier than using a proper distributed systems protocol at first, when you
lose customer data in production, you quickly learn that easy isn't best.
On Thu, Nov 20, 2014 at 9:56 AM, Mark Nijhof <
> Thank you!
> On Thu, Nov 20, 2014 at 3:51 PM, Imants Cekusins <> wrote:
>> the code is in
>> any comments are welcome!
> Mark Nijhof
> t: @MarkNijhof <https://twitter.com/MarkNijhof>
> s: marknijhof
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions