[erlang-questions] mnesia schema and table copy to other nodes

Chandru <>
Wed Jun 24 23:29:17 CEST 2009


Hi,

This has been discussed before a few times on the mailing list. See
http://erlang.org/pipermail/erlang-questions/2007-September/029530.html for
example.

cheers
Chandru

2009/6/24 Praveen Ray <>

> Hi
> I've recently started learning erlang/mnesia and need help setting up
> mnesia
> on two nodes. Here's the series of steps (on same host):
> $cd ~/test/foo
> $erl -sname foo -setcookie chip_cookie
>
>   1. mnesia:create_schema([node()]).
>   2. mnesia:start().
>   3. rd(person, {name,age}).
>   4.
>
> mnesia:create_table(person,[{attributes,record_info(fields,person)},{disc_copies,[node()]}]).
>   5. mnesia:dirty_write(#person{name="george", age=30}).
>
> # in another window, on same host:
> $cd ~/test/bar
> $erl -sname bar -setcookie chip_cookie
> 1> mnesia:start().
> #back on foo node:
> net_adm:ping('foo@*hostname*').
> *pong*
> mnesia:add_table_copy(schema, 'bar@*hostname*', disc_copies).
> *{aborted,{badarg,schema,disc_copies}} <--- WHY DOES THIS FAIL?*
> mnesia:add_table_copy(schema, 'bar@*hostname*', ram_copies).
> *{atomic,ok}*
> mnesia:add_table_copy(person, 'bar@*hostname*', disc_copies).
> *{atomic,ok}*
> *# back on node bar*
> mnesia:info().
> *It doesn't show the 'person' table that was copied from foo. Why is that?*
> How can I add more nodes to an existing mnesia database which was created
> with only one node ie. mnesia:create_schema([node()]).
> Thanks
> --
> Yellowfish Technologies Inc
> http://www.yellowfish.biz
> 
> (888) 817 2969 x 233
> gtalk/skype: praveenray
>


More information about the erlang-questions mailing list