[erlang-questions] permanently removing a mnesia node
Mon May 14 18:28:48 CEST 2007
Say I have a running mnesia cluster with four disk-copy nodes - node1,
node2, node3, node4. I shut down all four nodes. Then I discover that
the machines for node3 and node4 have disappeared, never to come
back. How do I get node1 and node2 working again such that they share
data with each other but no longer require the presence of node3 and
I can use force_load_table or set_master_nodes to get node1 and node2
running, but I'd have to do that every time I start the nodes, which
doesn't seem right. Furthermore, I then cannot make any subsequent
changes to the schema since schema operations appear to require all
disk-copy nodes to be present.
Note that if only one of node3 or node4 disappear I can use
del_table_copy to remove the schema copy from that node. However, if
more than one node has disappeared them del_table_copy fails since it
requires all other disk-copy nodes to be running. So in the example,
del_table_copy(schema, node3) complains that node4 isn't running and
del_table_copy(schema, node4) complains that node3 isn't running.
One suggestion from #erlang was to fake the disappeared nodes on another
machine, so that the aforementioned del_table_copy succeeds. That is a
rather complex operation though and feels like a hack.
Another suggestion was to create a backup of the db, remove all
references to the disappeared nodes from it (using a variation of the
change_node_name function from the Mnesia User Guide), and then restore
it. That is rather involved though, particularly when there are several
cluster nodes remaining.
Is there a better solution? Should the mnesia api perhaps be extended so
that when removing copies of the schema table it is possible to specify
*several* nodes, e.g. del_table_copy(schema, [node3, node4]) in the
example, and the operation succeeds as long as all remaining disk-nodes
More information about the erlang-questions