How do I send a module to an Erlang node?
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 mast开发者_如何学JAVAer node send code and modules to the other nodes. How can I do this?
use nl(module_name).
to load code on all the nodes.
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]),
精彩评论