Erlang: How to remove node from Mnesia cluster
<p>I am writing a distributed mnesia application and use a schema.
When a new node joins the cluster, it is added to the mnesia schema by a rpc call (from the masternode which started the schema) which runs the following functions:</p>

<pre><code>start_Mnesia(MasterNode) -&gt;
    mnesia:start(),
    mnesia:change_config(extra_db_nodes, [MasterNode]),
    Tabs=mnesia:system_info(tables) -- [schema],
    [mnesia:add_table_copy(Tab, node(), ram_copies) || Tab &lt;- Tabs].
</code></pre>

<p>When a node crashes or disconnects, the master node receives a <code>nodedown</code> event and the node should be removed from the cluster. How can I achieve this?</p>

<p>EDIT:
I ended up with following solution:
TabList is a list of all tables in my schema which my node is using.</p>

<blockquote>
  <p>mnesia:del_table_copy(TabList, Node)</p>
</blockquote>