Erlang Central

Remote Code Load

Revision as of 20:27, 11 January 2007 by GeScript (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Problem

Remote Load New Code to All Nodes

Solution

Solution attribution: this example is buried in erlang rpc multicall doc.

%% Find object code for module Mod 
{Mod, Bin, File} = code:get_object_code(Mod), 

%% and load it on all nodes including this one; 
%% the next time the code is called it will be using the new version
{Replies, _} = rpc:multicall(code, load_binary, [Mod, Bin, File,]),

%% and then maybe check the Replies list.

Discussion

This sort of change is tedious within other network infrastructures. see erlang.org rpc multicall doc for further details.