[erlang-questions] CNodes, FQDNs, and -name

James Aimonetti <>
Thu Aug 12 16:53:13 CEST 2010


On Wed, Aug 11, 2010 at 11:08 PM, Mikael Magnusson <> wrote:
> On Wed, 2010-08-11 at 18:04 -0700, James Aimonetti wrote:
>> How does the Erlang VM determine the FQDN when started with the -name
>> option? In my bash shell, hostname and hostname -f both return the
>> shortname of my laptop. I'm using the mod_erlang_event module for
>> freeSWITCH and even though I've set using sname to false, the module
>> registers the shortname (I think it uses the hostname call internally
>> to figure out what the node will be named) and my Erlang VM cannot
>> communicate with it.
>>
>> I read about inet_res (http://erldocs.com/R14A/kernel/inet_res.html)
>> and it looks like the VM might read from /etc/resolv.conf? I do have
>> "domain mydomain.org" in that file so its not surprising that the VM
>> picks it up (if that's even the mechanism by which the VM figures out
>> the domain). So, in the mod_erlang_event C code, how would I be able
>> to mimic the way the VM has figured out the longname of my laptop? (I
>> do not have a DNS entry for the laptop at this domain).
>>
>
> You should make sure that the first name listed for your IP address
> in /etc/hosts is the FQDN. That should fix the problem with hostname -f
> not giving you the FQDN.
>
> /Mikael

With my laptop, the FQDN is rarely valid. When at work, the
resolv.conf has the work domain listed. Now that I'm home on DSL, the
resolv.conf lacks any domain line.

Also, now that I'm home, I can no longer start my VM with the -name
option with just a node name; the VM errors with "Can't set long node
name". I don't think setting the hosts file with something helped
(unless it can't be arbitrary). I can put a full 
for the -name parameter, but as I'd like to put my applications on
several boxes, I'd like it to get picked up automatically. This issue
will be moot once I deploy, but its a small gotcha when doing local
development that I'd like to eliminate for the CNode code.

I guess I would like to update the CNode to respond more like the VM
in determining the hostname for the node, but am not sure the
mechanism by which the VM sets the node's name when using -sname and
-name with just a node and no host.

Thanks for any pointers/ideas.

James


More information about the erlang-questions mailing list