[erlang-questions] detection of hostname
Tue Oct 23 02:09:52 CEST 2012
I had a similar question not too long ago, and the response I got was this:
Using 'erl -name something' without an @ sign is generally preferred, but
your machine has to be configured right. In Linux specifically, you can use
hostname -f to see what name Erlang will choose by default. If this name is
not correct and you don't want to fight it, then just pass the machine's
own IP address or more appropriate DNS using the @ sign with erl -name.
On Mon, Oct 22, 2012 at 5:27 PM, Dmitry Kolesnikov
> Hello Vlad,
> I believe your question relates a network planning and administration...
> According to my understanding Erlang uses DNS resolver routine supplied by
> Of course, if host has multiple names then this becomes an issue.
> 1. You have to come up with particular schema of FQDN assignment to you
> 2. You have to resolve synchronization of /etc/hosts across multiple node
> in the cluster.
> 3. If you have multiple adapter then they either provides HA within same
> network or accesses different sub-network. I do not think that you are
> planning to run Erlang cluster across different sub-networks.
> So, I would repeat again but DNS is a standard way of retrieving host name
> but you have to put an effort to configure it.
> I've been always running Erlang clusters within same IP network. I've used
> both approaches /etc/hosts and IP. IP worked fine when node had a static
> address but /etc/hosts were used with dynamic IP.
> - Dmitry
> On Oct 22, 2012, at 11:41 PM, Vlad Dumitrescu wrote:
> > Hi Dmitry,
> > On Mon, Oct 22, 2012 at 10:07 PM, Dmitry Kolesnikov
> > <> 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
> >>> http://erlang.org/mailman/listinfo/erlang-questions
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions