[erlang-questions] Ridiculuous newbie mnesia question.

Ulf Wiger <>
Wed Oct 27 09:04:06 CEST 2010


On 27 Oct 2010, at 05:37, Jeffrey Rennie wrote:

> Thank you for your patience.  I still haven't escaped from this wet paper
> bag:
> 
>> Looking at the mnesia:info() output, there are a couple of things
>> to note.
>> 
>> 1. 'running db nodes = []' means that while 
>>   and  might be running at the erlang level, perhaps even
>>   with mnesia runnin, they are not connected to 
>> 
> 
> Why aren't they connected?  How do I connect them?  I can ping them (see
> below.)


Use the extra_db_nodes parameter for the nodes that do not have a persistent
copy of the schema.

For example, if you have nodes A, B, and C, where A and B have a persistent
schema, you would initially create the schema from either A or B:

mnesia:create_schema([A,B]).

...making sure that both nodes A and B are reachable at the time.

Then when starting mnesia on C, you can either do this:

mnesia:start([{extra_db_nodes,[A,B]}])

or add it to the erl command line:

erl -sname c -mnesia extra_db_nodes \[\]

note the shell-related escaping issues. If your node names have special
characters, you have to include the single quotes and escape them too.

You can also create a sys.config file, where you insert application environment
variables:

sys.config:
[{mnesia, 
   [ {extra_db_nodes, [, ]} ]
 }].

then start Erlang with erl -sname c -config sys

The extra_db_nodes parameter tells mnesia where to go and find the 
persistent schema, so you would usually include all nodes that are known
to have a persistent schema in the list.

BR,
Ulf W

Ulf Wiger, CTO, Erlang Solutions, Ltd.
http://erlang-solutions.com





More information about the erlang-questions mailing list