1
votes

I have several nodes running in an erlang cluster, each using the same magic cookie and trusted by each other. I want to have one master node send code and modules to the other nodes. How can I do this?

2

2 Answers

7
votes

use nl(module_name). to load code on all the nodes.

5
votes

Check out my etest project for an example of programmatically injecting a set of modules on all nodes and then starting it.

The core of this is pretty much the following code:

{Mod, Bin, File} = code:get_object_code(Mod),
{_Replies, _} = rpc:multicall(Nodes, code, load_binary,
                              [Mod, File, Bin]),