[erlang-questions] How to distribute code using code server to slave nodes (II)

Angel <>
Wed Jul 22 13:22:16 CEST 2009


Hi again

More on this issue ive managed to start a remote node using the code server

start erlang in distribute mode.. on the Master Node.

start the code server...
code_server4:start( MyRemoteSlave).

and finally  

slave:start(MyRemoteSlave,Nost,Name,SomeArgs).

where SomeArgs contains "-setcookie mycookie and -hosts <master node IP> -loader inet"

resulting in a timeout failure to start and setup the remote slave.

But if i logon on the slave node and do...

:~> erl -hosts <MasterIP> -loader inet -id one@<MyRemoteSlave> -name one@<MyRemoteSlave> -setcookie mycookie

¡¡it success!!

Erlang R13B01 (erts-5.7.2) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.7.2  (abort with ^G)
()1>


tcpdump shows network activity while the remote code server ask Master code server for the required stuff..
(adding +l to erl cmdline show remote code loading)

So the aproach is correct but the remote node fails to load all the required code in time and the slave module on the master
complains about timeout.

¿¿Can i tweak this timeout value in order to let the remote node finish its code loading??      

I whant to use "-loader inet" to avoid having to deploy my app code all over the remote nodes by hand.

Regards Angel


El Miércoles, 22 de Julio de 2009 00:06:06 Angel Alvarez escribió:
> Hi
> 
> Im learning erlang so i use to write toy programs just for fun
> now Im learning to use the pool module, so i cant spread workers over some computers.
> 
> The problem is that prior to pspawn processes i have to manually distribute code among all members of the pool.
> I use to write something like this (i saw this somewhere on the net...)
> 
> 	pool:start(pooltest, lists:concat(["-setcookie ", erlang:get_cookie()])),
> 	distribute_app([mymodule1,mymodule2, ... , mymodulen]),
> 
> 
> with distribute_app as:
> 
> distribute_app(Modules) ->
>         %% extraer todos los nodos excepto el Master
>         RemoteNodes = [X || X <- pool:get_nodes(), X =/= node()],
>         %% Transferir el código
>         lists:foreach(fun(Node) -> transfer_code(Node, Modules) end, RemoteNodes).
> 
> transfer_code(Node, Modules) ->
>         [transfer_module(Node, Module) || Module <- Modules].
> 
> transfer_module(Node, Module) ->
>         {_Module, Binary, FileName} = code:get_object_code(Module),
>         rpc:call(Node, code, load_binary, [Module, FileName, Binary]).
> 
> Instead of doing this, can i instruct remote code servers to ask master code server for code when
> it need to locate new refences?
> 
> Is seems to be related to starting erl with "--loader inet" ¿Can anyone prove me with some pointers about this? 
> 
> Thanks
> 



-- 
No imprima este correo si no es necesario. El medio ambiente está en nuestras manos.
__________________________________________

Clist UAH a.k.a Angel
__________________________________________
MySQL5: Vale, corromper los datos de forma silente no era una buena idea despues de todo.


More information about the erlang-questions mailing list