how do I remove an extra node

后端 未结 4 1591
你的背包
你的背包 2021-02-04 13:25

I have a group of erlang nodes that are replicating their data through Mnesia\'s \"extra_db_nodes\"... I need to upgrade hardware and software so I have to detach some nodes as

4条回答
  •  春和景丽
    2021-02-04 14:03

    I've certainly used this method to perform this (supporting the mnesia:del_table_copy/2 use). See removeNode/1 below:

    -module(tool_bootstrap).
    
    -export([bootstrapNewNode/1, closedownNode/0,
         finalBootstrap/0, removeNode/1]).
    
    -include_lib("records.hrl").
    
    -include_lib("stdlib/include/qlc.hrl").
    
    bootstrapNewNode(Node) ->
        %% Make the given node part of the family and start the cloud on it
        mnesia:change_config(extra_db_nodes, [Node]),
        %% Now make the other node set things up
        rpc:call(Node, tool_bootstrap, finalBootstrap, []).
    
    removeNode(Node) ->
        rpc:call(Node, tool_bootstrap, closedownNode, []),
        mnesia:del_table_copy(schema, Node).
    
    finalBootstrap() ->
        %% Code removed to actually copy over my tables etc...
        application:start(cloud).
    
    closedownNode() ->
        application:stop(cloud), mnesia:stop().
    

提交回复
热议问题