[erlang-questions] Support for newcomers and the popularity of Erlang

Ulf Wiger <>
Mon Mar 19 18:45:09 CET 2012


Not sure if you've seen the (admittedly short) tutorials on TrapExit:

http://www.trapexit.org/Distributing_a_Mnesia_schema

A minor comment: you can do this instead:

mnesia:start([{extra_db_nodes, Nodes}])

If you want the nodes to start from a boot script, you can either roll your own the old-fashioned way:

http://www.trapexit.org/OTP_Release_Handling_Tutorial

or use rebar and Reltool:

http://www.metabrew.com/article/erlang-rebar-tutorial-generating-releases-upgrades

In this case, it's better to put the extra_db_nodes setting in the sys.config file:

[…,
 {mnesia, [ 
                   {extra_db_nodes, [, ]}
                  ]}

Then, calling mnesia:start() will suffice, given that you've started the node in the right way.

BR,
Ulf W

On 19 Mar 2012, at 17:59, Wojciech Knapik wrote:

> I much prefer to have a slightly more strict setup, where you e.g. designate one or two "master" machines that keep a persistent copy of the database. The other machines can start up with the env variable: extra_db_nodes : MasterNodes, and access the database without even having their own copy.
> 
> Why does the data need to be fully replicated? Nodes starting with extra_db_nodes as above enjoy full distribution transparency. If very rapid read response is required, you can add a ram-based replica on the fly with the function mnesia:add_table_copy_type(Table, Node, CopyType). 
> 
> Update cost will increase noticeably with every replica you add, so in many cases, it may be counter-productive to use full replication. For fault tolerance, having two persistent copies of the data goes a long way.
> 
> Nodes can also start with extra_db_nodes, receive a ram copy of the schema, and then change their schema to a persistent copy using mnesia:change_table_copy_type(schema, node(), disc_copies).
> 
> Ok, that's a lot to process for someone new to mnesia, so let me answer this fully, once I'm back home from work. 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120319/d4c6fb8a/attachment.html>


More information about the erlang-questions mailing list