set sname after startup?

Rob <>
Tue Jun 29 20:21:57 CEST 2004


Bengt Kleberg wrote:
> Rob wrote:
>> Hi,
>>
>> I am working on a system where I would like to have the nodes get 
>> their name and cookie info from their environment and a config file.
>>
>> Is there any way to set the name/sname parameters from inside a 
>> running erlang process?
> 
> with the help of the module index with search 
> (http://www.corelatus.com/~matthias/modules.html) it is possible to find 
> that module net_kernel handles what you want. this it the relevant 
> paragraf:
> 
> This is done by the system itself, but the |start([Name])| function can 
> also be called directly from the normal Erlang shell prompt, and a 
> normal Erlang runtime system is then converted to a node. The kernel can 
> be shut down with the function |stop()|, but only if the kernel was not 
> started by the system itself. The node is then converted into a normal 
> Erlang runtime system. All other nodes on the network will regard this 
> as a total node crash.
> 
> bengt

Thanks, that does seem to be important, because when I tried doing:

net_kernel:start([foo]).

I got an error and if I tried set_cookie, I got an error. I had to have
a cookie file created before I could run the net_kernel:start([foo]).
command and then after that I could run set_cookie(node(), 'mycookie').

My next question whether there is a way to change the system to use IP
address rather than hostname or FQDN.

Rob





More information about the erlang-questions mailing list