mnesia node table copy shortcut?

Jan Koum <>
Thu Dec 31 04:03:38 CET 2009


hi folks,

is there a shortcut which would let me copy all the tables from one node to
another node in a single command?  right now when i bring up a new node, i
have to do:

mnesia:add_table_copy(table1a, node(), ram_copies),
mnesia:add_table_copy(table1b, node(), ram_copies),
...
mnesia:add_table_copy(table2a, node(), disc_copies),
mnesia:add_table_copy(table2b, node(), disc_copies),
....
mnesia:add_table_copy(table3a, node(), disc_only_copies),
mnesia:add_table_copy(table3b, node(), disc_only_copies).

i came across this shortcut on the web while searching for answer, but it
copies ALL tables into XYZ

Tabs = mnesia:system_info(tables) -- [schema],
[mnesia:add_table_copy(Tab,node(), XYZ) || Tab <- Tabs].

is there a way to modify above command to copy all ram_copies table as
ram_copies, disc_copies table as disc_copies, and disc_only_copies as
disc_only_copies?  thanks and happy new years,

-- yan


More information about the erlang-questions mailing list