[erlang-questions] Ridiculuous newbie mnesia question.
Jeffrey Rennie
<
>
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 = [
]' 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.)
> 2. The line '"c:/.../
" 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([
,
]).
(
)4> backgammon:init().
{atomic,ok}
(
)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/
" is used.
use fallback at restart = false
running db nodes = [
]
stopped db nodes = []
master node tables = []
remote = [game_record]
ram_copies = []
disc_copies = [schema]
disc_only_copies = []
[] = [game_record]
[{
,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
(
)6> net_adm:ping(
).
pong
(
)7> net_adm:ping(
).
pong
(
)8>
More information about the erlang-questions
mailing list