Erlang Mailing Lists

Author Message

<  Erlang questions mailing list  ~  mnesia question: full database replication across the severa

Guest
Posted: Fri Aug 28, 2009 11:55 am Reply with quote
Guest
Hi! I have a distributed mnesia application that have to create new
tables during it's work.
I want to keep all tables replicated on all mnesia nodes in my
cluster.
What if the table has been created at the moment when some of the
cluster nodes were down? Is there a standard solution to make full
database replication across the several nodes?

________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org

Post received from mailinglist
Guest
Posted: Sat Aug 29, 2009 10:01 am Reply with quote
Guest
Got it. Thanks for your answers everyone. Wink

________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org

Post received from mailinglist
Guest
Posted: Sat Aug 29, 2009 11:44 am Reply with quote
Guest
Here is what I got:

start_replica(Master_node) when is_atom(Master_node) ->
ok = mnesia:start(),

case mnesia:change_config(extra_db_nodes, [Master_node]) of
{ok, _} -> ok;
{error, E} -> erlang:error({change_config_failed, E})
end,

mnesia:change_table_copy_type(schema, node(), disc_copies),

Tables = mnesia:system_info(tables),
Table_types = [ {T, mnesia:table_info(T, where_to_commit)} || T <-
Tables ],

[ {T, mnesia:add_table_copy(T, node(), Type) } || {T, [_, Type]} <-
Table_types ].


Does this look reasonable or have I done something wrong?

Thanks in advance.

________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org

Post received from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum