How to join existing distributed mnesia database

Dan Gudmundsson dgud@REDACTED
Tue Feb 14 12:49:15 CET 2006


Without testing something like should work.

On app2@REDACTED:

mnesia:start().
mnesia:change_config(extra_db_nodes, [app1@REDACTED]).
mnesia:change_table_copy_type(schema, node(), disc_copies).
Tabs = mnesia:system_info(tables) -- [schema].
[mnesia:add_table_copy(Tab,node(), disc_copies) || Tab <- Tabs].

You should check the return values, though :-)

/Dan

Taavi Talvik writes:
 > Hello!
 > 
 > Lets say, I have created schema on app1@REDACTED,
 > all distribution is enabled etc. Fiew tables are created.
 > i.e.
 > 
 > 	mnesia:create_schema(['app1@REDACTED']).
 > 
 > 	mnesia:create_table(my_table,
 >           	                              [{disc_copies, 
 > ['app1@REDACTED']},
 >           	                               {type, set},
 >           	                               {attributes, 
 > record_info(fields, my_table)}]),
 > 
 > Now I want to add app2@REDACTED
 > 
 > How can I get second system, lets say app2@REDACTED to situation
 > where all schema and tables are fully replicated
 > i.e. equivalent to situation, where they have worked together
 > from beginning
 > 
 > 	mnesia:create_schema(['app1@REDACTED', 'app2@REDACTED']).
 > 
 > 	mnesia:create_table(my_table,
 >           	                              [{disc_copies, ['app1@REDACTED', 
 > 'app2@REDACTED']},
 >           	                               {type, set},
 >           	                               {attributes, 
 > record_info(fields, my_table)}]),
 > 
 > 
 > best regards,
 > taavi



More information about the erlang-questions mailing list