[erlang-questions] detection of hostname
Vlad Dumitrescu
vladdu55@REDACTED
Mon Oct 22 22:41:17 CEST 2012
Hi Dmitry,
On Mon, Oct 22, 2012 at 10:07 PM, Dmitry Kolesnikov
<dmkolesnikov@REDACTED> wrote:
> You have two options:
> 1. You are using FQDN for node name and relies on DNS. If you do not have DNS infra then like you notice /etc/hosts will help you on Unix/Linux, on Win an equivalent should exist.
This doesn't help if Erlang uses another method and uses another host
name, does it?
> 2. You are using IP address.
For which network adapter, when we have several? I'd have to add a
configuration parameter...
My question could be restated in a different way: is there a standard
way of retrieving the host name in such a way as to get an useable
name? Like in which order to query services, and such. If yes, does
Erlang use it? If no, why not?
Thanks!
regards,
Vlad
>
> On Oct 22, 2012, at 10:53 PM, Vlad Dumitrescu wrote:
>
>> Hi!
>>
>> In erlide we are starting erlang nodes from Java and lately we had
>> (and still have some) trouble with retrieving a host name that works.
>>
>> The latest versions are starting an erlang node with "erl -name foo"
>> and read the hostname used by it. Today I got a report that this
>> method is not reliable either: for a machine called "desktop", erlang
>> may detect it is on a network and use "desktop.domain.com" as
>> hostname. But the DNS might not be able to resolve that name, and it
>> may not be in /etc/hosts either. So even if two erlang nodes can
>> connect to each other using this name, other programs that use other
>> ways to resolve the name can't connect.
>>
>> I've been trying hardcoding "localhost" and "127.0.0.1" but that makes
>> the nodes unreachable from other machines, so one can't reliably do
>> RPCs.
>>
>> My knowledge about name resolution in networking is poor (just what I
>> discovered while fighting this issue), so I'll ask a dumb question:
>> isn't there a method to get a host name that can be use in all
>> circumstances (when there is one)? That is it should be resolvable by
>> the OS, not something made-up from the machine name and the network
>> id...
>>
>> Or if anybody has a suggestion for another method for starting an
>> Erlang node that one can later always connect to, I am open for
>> suggestions.
>>
>> I could keep adding checks (look for /etc/hosts myself, query the DNS,
>> etc), but I can't possibly cover all OSs and all possible network
>> configurations. It feels like this is an operation that should have a
>> standardized implementation...
>>
>> Thanks in advance!
>> best regards,
>> Vlad
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>
More information about the erlang-questions
mailing list