[erlang-questions] Ridiculuous newbie mnesia question.

Jeffrey Rennie surferjeff@REDACTED
Wed Oct 27 05:37:38 CEST 2010


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 = [emacs@REDACTED]' means that while a@REDACTED
>    and b@REDACTED might be running at the erlang level, perhaps even
>    with mnesia runnin, they are not connected to emacs@REDACTED
> 

Why aren't they connected?  How do I connect them?  I can ping them (see
below.)

> 2. The line '"c:/.../Mnesia.emacs@REDACTED" is NOT used' means that
>     you have not created a persistent schema. Normally, the persistent
>     schema indicates which nodes are part of the mnesia cluster. Any
>     other nodes that want to join should specify -mnesia extra_db_nodes
> Ns,
>     where Ns includes at least some of the nodes listed in the
> persistent schema.
> 
> To create a persistent schema, you run this before starting mnesia:
> 
> mnesia:create_schema(Nodes).
> 
> ...with the nodes in Nodes all up and running. You only need to call it
> from one node; it will create a schema on each node automatically.

I tried that.  I didn't specify the other nodes because the documentation
for mnesia:create_schema says to specify disk copy nodes only, and I want
ram copy nodes.

But mnesia:info() still shows me I'm not connected to anything:

-module(backgammon).

-compile(export_all).

-include("backgammon.hrl").

create_tables(MnesiaNodes) ->
    mnesia:create_table(game_record,
			[{attributes, record_info(fields, game_record)},
			 {ram_copies, MnesiaNodes}]).

init() ->
    mnesia:create_schema([]),
    mnesia:start(),
    create_tables([a@REDACTED, b@REDACTED]).


(emacs@REDACTED)4> backgammon:init().
{atomic,ok}
(emacs@REDACTED)5> mnesia:info().
---> Processes holding locks <--- 
---> Processes waiting for locks <--- 
---> Participant transactions <--- 
---> Coordinator transactions <---
---> Uncertain transactions <--- 
---> Active tables <--- 
schema         : with 2        records occupying 546      words of mem
===> System info in version "4.4.13", debug level = none <===
opt_disc. Directory
"c:/Users/jeff/code/code/scratch/erlang/Mnesia.emacs@REDACTED" is used.
use fallback at restart = false
running db nodes   = [emacs@REDACTED]
stopped db nodes   = [] 
master node tables = []
remote             = [game_record]
ram_copies         = []
disc_copies        = [schema]
disc_only_copies   = []
[] = [game_record]
[{emacs@REDACTED,disc_copies}] = [schema]
3 transactions committed, 0 aborted, 0 restarted, 1 logged to disc
0 held locks, 0 in queue; 0 local transactions, 0 remote
0 transactions waits for other nodes: []
ok
(emacs@REDACTED)6> net_adm:ping(a@REDACTED).
pong
(emacs@REDACTED)7> net_adm:ping(b@REDACTED).
pong
(emacs@REDACTED)8>






More information about the erlang-questions mailing list