Erlang: How to remove a node from a Mnesia cluster

I am writing a mnesia distributed application and using a schema. When a new node cluster joins the cluster, it is added to the mnesia schema by calling rpc (from the mask that starts the schema), which performs the following functions:

start_Mnesia(MasterNode) ->
    mnesia:start(),
    mnesia:change_config(extra_db_nodes, [MasterNode]),
    Tabs=mnesia:system_info(tables) -- [schema],
    [mnesia:add_table_copy(Tab, node(), ram_copies) || Tab <- Tabs].

When a node fails or shuts down, the node wizard receives an event nodedown, and the node must be removed from the cluster. How can I achieve this?

EDIT: I got the following solution: TabList is a list of all the tables in my schema that my node uses.

mnesia: del_table_copy (TabList, Node)

+3
source share
1 answer

, . :

del_table_copy (, Node) β†’ {aborted, R} | {atomic, ok}

Tab node. , .

. Mnesia node . , Mnesia node.

+1

All Articles