Erlang Mailing Lists

Author Message

<  Erlang questions mailing list  ~  Different hostname from erl -sname and inet:gethostname()

Guest
Posted: Sun Sep 25, 2011 11:20 pm Reply with quote
Guest
Hi erlang-questions,

I have the following behaviour:

[~]$ erl -sname foobar
Erlang R14B (erts-5.8.1) [source] [64-bit] [smp:4:4] [rq:4]
[async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.8.1 (abort with ^G)
(foobar@localhost)1> inet:gethostname().
{ok,"pufpuf"}

Notice the different 'localhost' and 'pufpuf' hostnames.

I am running Erlang R14B-2 on ArchLinux 3.0.

[~]$ hostname
pufpuf

[~]$ cat /etc/hosts
#<ip-address> <hostname.domain.org> <hostname>
127.0.0.1 localhost.localdomain localhost pufpuf
::1 localhost.localdomain localhost

Is it normal behaviour? I am using things like:

{ok, Hostname} = inet:gethostname(),
slave:start(Hostname, slave_node, []).

which obviously fails under such circumstances.
Is there a different approach to this? Is my system misconfigured?

/Ignas
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions
Post received from mailinglist
Guest
Posted: Sun Sep 25, 2011 11:51 pm Reply with quote
Guest
Hi!

The inet:gethostname() function returns the name of the system that the node is running on. This is the name that is printed by the hostname command. This persistent configuration data is not stored in the /etc/hosts, but in the /etc/hostname file.


The presence of your hostname in the /etc/hosts file is to ensure that the local system is reachable at the loopback address, if needed.


If you always want to start a node on localhost and use short names you can use use slave:start("localhost", slave_node, []).


MVH Magnus

2011/9/26 Ignas Vyšniauskas <baliulia@gmail.com (baliulia@gmail.com)>
Quote:
Hi erlang-questions,

I have the following behaviour:

[~]$ erl -sname foobar
Erlang R14B (erts-5.8.1) [source] [64-bit] [smp:4:4] [rq:4]
[async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.8.1  (abort with ^G)
(foobar@localhost)1> inet:gethostname().
{ok,"pufpuf"}

Notice the different 'localhost' and 'pufpuf' hostnames.

I am running Erlang R14B-2 on ArchLinux 3.0.

[~]$ hostname
pufpuf

[~]$ cat /etc/hosts
#<ip-address>   <hostname.domain.org>   <hostname>
127.0.0.1       localhost.localdomain   localhost    pufpuf
::1             localhost.localdomain   localhost

Is it normal behaviour? I am using things like:

{ok, Hostname} = inet:gethostname(),
slave:start(Hostname, slave_node, []).

which obviously fails under such circumstances.
Is there a different approach to this? Is my system misconfigured?

/Ignas
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org (erlang-questions@erlang.org)
http://erlang.org/mailman/listinfo/erlang-questions



Post received from mailinglist
Guest
Posted: Mon Sep 26, 2011 12:14 am Reply with quote
Guest
In hindsight, i missed your last question. If you do want pufpuf to be the name for 127.0.0.1 you can place it at the head of the list of names associated with an address in your hosts file.

127.0.0.1
Guest
Posted: Mon Sep 26, 2011 9:58 am Reply with quote
Guest
On Mon, Sep 26, 2011 at 02:14:40AM +0200, Magnus Klaar wrote:
> In hindsight, i missed your last question. If you do want pufpuf to be the
> name for 127.0.0.1 you can place it at the head of the list of names
> associated with an address in your hosts file.
>
> 127.0.0.1 pufpuf localhost.localdomain localhost
> ::1 pufpuf localhost.localdomain localhost

On a local network other machines may resolve 'pufpuf' to its external
interface address, but 'pufpuf' itself resolves then name to the
loopback address. This discrapancy can confuse NFS, automounter, etc...

For the sake of Erlang/OTP you do not need to put the short hostname
on the loopback address; if inet:gethostbyname fails to resolve
the short hostname it will fall back to using the loopback address.

> _______________________________________________
> erlang-questions mailing list
> erlang-questions@erlang.org
> http://erlang.org/mailman/listinfo/erlang-questions


--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions
Post received from mailinglist
wuji
Posted: Mon Aug 13, 2012 8:05 am Reply with quote
User Joined: 10 Aug 2012 Posts: 654
of one percent of those stops did the motorist choose choose [h2]cheap polo ralph lauren[/h2] choose to flee."Attorney Stephanie Yablow lobbied hard for reforms after
elderly mother and father were injured in a high speed speed jordan 6 olympic speed chase. She was shocked to learn how little recourse
had."You've got to ask, is it worth it?" she said.It's said.It's cheap Ralph Lauren said.It's a judgment police officers have to make on the
Jurors Convict Accused Ringleader17-Year-Old Found Guilty of Aggravated Battery in in jordan 6 olympic 2012 in Teen-Burning TrialBy ALON HARISHJune 19. 2012— Jurors in Fort
Fla., Tuesday evening convicted 17-year-old Matthew Bent of aggravated battery battery [h4]cheap Ralph Lauren[/h4] battery for his role in the 2009 torching of Michael
his middle-school classmate.Prosecutors failed to secure a conviction on Bent's Bent's [h3]cheap designer *beep*[/h3] Bent's second-degree attempted murder charge. Bent would have faced up
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum