Remove running node from mnesia cluster

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Remove running node from mnesia cluster

Kristoffer Brown
Hello all,

I have a requirement to remove a running node from an mnesia cluster. This is a legitimate node that needs to have some maintenance performed. However, we want to keep this node running and servicing requests. I found this post. Which helps remove it from the additional nodes. However, once you re-start mnesia on the orphan node, it returns to the other nodes in the cluster.

From each of the non-orphan nodes, I run a script that does the following:

    rpc:call('node_to_be_orphaned', mnesia, stop, []),
    mnesia:del_table_copy(schema, 'node_to_be_orphaned'),

^^ At this point mnesia:system_info(db_nodes) shows that the node has indeed been removed.    

    rpc:call('node_to_be_orphaned', mnesia, start, []),

Now it's back. Ugh!

So, I then tried to flip it and remove the other nodes from the orphan first adding the following.

    rpc:call(ThisNode, mnesia, stop, []),
    rpc:call('node_to_be_orphaned', mnesia, del_table_copy, [schema, node()]),
    rpc:call(ThisNode, mnesia, start, []),

This just creates a loop with no difference.

Is there a way to take a node out of mnesia clustering while leaving it up-and-running?

Any and all guidance is greatly appreciated.

Best.

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Remove running node from mnesia cluster

Martin Karlsson-2

Is there a way to take a node out of mnesia clustering while leaving it up-and-running?


Hi Kristoffer,

I'm no mnesia expert but I remember reading that to completely remove a node you need to delete the schema on the "orphaned" node before starting it again. Look under chapter 5.6 in mnesia user guide (http://www.erlang.org/doc/apps/mnesia/Mnesia_chap5.html)

So your script would look like this:

   rpc:call('node_to_be_orphaned', mnesia, stop, []),
   mnesia:del_table_copy(schema, 'node_to_be_orphaned'),
   mnesia:delete_schema(['node_to_be_orphaned']), 
   rpc:call('node_to_be_orphaned', mnesia, start, []).

Note that all data on the orphaned node will be lost.

Cheers,
Martin








_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions