Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mnesia Clustering

If I am clustering 2 nodes together, from my experimenting and reading up online I understand that Node A will be like a "master" node and Node B will copy the tables over if I want them to. (Otherwise it will just access them remotely.)

What happens though if Node B goes down? Does it just recopy the data that's been changed since it was last up?

Also what happens if Node A goes down. Is Node B still usable? If so, if data is changed on Node B, does Node A copy it over to itself? My understanding so far is that Node A doesn't care about what Node B says, but someone please tell me I'm wrong.

like image 401
ewindsor Avatar asked Nov 02 '10 18:11

ewindsor


1 Answers

Since the accepted answer is a link only answer, figured I would document this for anyone who comes along:

  1. Mnesia doesn't quite work by having a primary-secondary architecture. Instead, some nodes have local copies of data, and some have remote copies. (You can see this by running mnesia:info() from the console. There is a list of remote tables, and a list for each of the local-tables: ram_copies,disc_copies and disc_only_copies.)
  2. If a node goes down, as long as there is some table with a local copy, operations involving that table are fine.
  3. One of the down-sides with Mnesia is that it is subject to network partition events. If in your cluster the network connection between two nodes goes bad, then each one will think that the other node is down, and continue to write data. Recovery from this is complicated. In the more mundane case though, if one node goes down, then nodes with local copies of data continue along, and when the down-node recovers, it syncs back up with the cluster.
like image 142
James Kingsbery Avatar answered Oct 13 '22 08:10

James Kingsbery