Just to add to this, there are some implementations of things like consensus algorithms in Erlang such as Ra: https://github.com/rabbitmq/ra
Riak Core is extremely cool, but Riak is dead by now. It was a child of the times when NoSQL was cool. Still, basho code is interesting to read. (https://github.com/basho/riak_core)
Self-ads: we've tried to remove Mnesia from our project, HN post incoming, once the library is prettified and tested hard (https://github.com/esl/cets).