mnesia node replication

Fredrik Thulin ft@REDACTED
Wed Apr 26 08:09:50 CEST 2006

On Tuesday 25 April 2006 22:02, Tony Zheng wrote:
> Hi
> I created two mnesia nodes(one@REDACTED and two@REDACTED) and they can
> replicate very well. I want to add a new node on
> server3(three@REDACTED) and make it to replicate all data from
> one@REDACTED or two@REDACTED, how can I do it?
> I used mnesia:create_schema([three@REDACTED]) and
> mnesia:add_table_copy(Tab, three@REDACTED, Type), but it didn't work.
> Thanks.
> tony

Roughly (on three@REDACTED) :

  mnesia:change_config(extra_db_nodes, [MasterNode]),

  DiscC = mnesia:table_info(Table, disc_copies),
  case lists:member(node(), DiscC) of
      true ->
          %% table already present on node
      false ->
          RamC = mnesia:table_info(Table, ram_copies),
          case lists:member(node(), RamC) of
              true ->
                mnesia:change_table_copy_type(Table, node(),   
              false ->
                mnesia:add_table_copy(Table, node(), disc_copies)

That is how I do it in YXA (see src/bootstrap.erl). It converts RAM 
copies to disc copies, or just add a disc copy if table is not present 
on node().


More information about the erlang-questions mailing list