[erlang-questions] Erlang Nodes can't communicate with each other

Harit Himanshu harit.subscriptions@REDACTED
Mon Jan 19 17:44:58 CET 2015


Thanks Daniel, I just tried that, I see different issue now

*Server*

root@REDACTED:/code# ifconfig

eth0      Link encap:Ethernet  HWaddr 02:42:ac:11:00:3e

          inet addr:172.17.0.62  Bcast:0.0.0.0  Mask:255.255.0.0

          inet6 addr: fe80::42:acff:fe11:3e/64 Scope:Link

          UP BROADCAST RUNNING  MTU:1500  Metric:1

          RX packets:15 errors:0 dropped:0 overruns:0 frame:0

          TX packets:14 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:1260 (1.2 KB)  TX bytes:1088 (1.0 KB)


lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:65536  Metric:1

          RX packets:30 errors:0 dropped:0 overruns:0 frame:0

          TX packets:30 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:1674 (1.6 KB)  TX bytes:1674 (1.6 KB)


root@REDACTED:/code# erl -name gru@REDACTED -setcookie abc

Erlang/OTP 17 [erts-6.0] [source] [64-bit] [smp:8:8] [async-threads:10]
[hipe] [kernel-poll:false]


Eshell V6.0  (abort with ^G)

(gru@REDACTED)1> kvs:start()

(gru@REDACTED)1> .

true

(gru@REDACTED)2>

*Client*

(minion1@REDACTED)6> rpc:call(gru@REDACTED, kvs, store, [weather,
fine]).

* 1: syntax error before: '.'

(minion1@REDACTED)6> rpc:call('gru@REDACTED', kvs, store, [weather,
fine]).

{badrpc,nodedown}

(minion1@REDACTED)7>

=ERROR REPORT==== 19-Jan-2015::16:42:56 ===

** System NOT running to use fully qualified hostnames **

** Hostname 172.17.0.62 is illegal **





I don't understand why Host is illegal, any ideas?
Thanks

On Mon, Jan 19, 2015 at 8:22 AM, Daniel Hallin Widgren <
daniel.widgren@REDACTED> wrote:

> Hi,
>
> Have you tried to use -name mynode@REDACTED instead of -sname mynode? I think
> you need long name activated to talk to each other.
>
> regards,
> Daniel
>
> 2015-01-19 17:05 GMT+01:00 Harit Himanshu <harit.subscriptions@REDACTED>:
>
>> Hi
>>
>> I am learning Distributed programming and in order to work through it, I
>> started 2 docker containers using images provided by Mark Nijhof (
>> https://github.com/MarkNijhof/erlang_docker)
>>
>> So now when I start my docker containers (on same Macbook), I observe
>> that they are not able to talk to each other
>>
>> *Server*
>>
>> root@REDACTED:/code# erl -sname gru -setcookie abc
>>
>> Erlang/OTP 17 [erts-6.0] [source] [64-bit] [smp:8:8] [async-threads:10]
>> [hipe] [kernel-poll:false]
>>
>>
>> Eshell V6.0  (abort with ^G)
>>
>> (gru@REDACTED)1> kvs:start().
>>
>> true
>>
>> (gru@REDACTED)2>
>>
>> *Minion*
>>
>> ➜  erlang_docker git:(master) docker run -t -i erlang-build-box /bin/bash
>>
>> root@REDACTED:/# mkdir code
>>
>> root@REDACTED:/# cd code
>>
>> root@REDACTED:/code# vi kvs.erl
>>
>> root@REDACTED:/code# erl -sname minion1 -setcookie abc
>>
>> Erlang/OTP 17 [erts-6.0] [source] [64-bit] [smp:8:8] [async-threads:10]
>> [hipe] [kernel-poll:false]
>>
>>
>> Eshell V6.0  (abort with ^G)
>>
>> (minion1@REDACTED)1> rpc:call(gru@REDACTED, kvs, store,
>> [weather, fine]).
>>
>> {badrpc,nodedown}
>>
>> (minion1@REDACTED)2> rpc:call(gru@REDACTED, kvs, store,
>> [weather, fine]).
>>
>> {badrpc,nodedown}
>>
>> (minion1@REDACTED)3> c(kvs).
>>
>> {ok,kvs}
>>
>> (minion1@REDACTED)4> rpc:call(gru@REDACTED, kvs, store,
>> [weather, fine]).
>>
>> {badrpc,nodedown}
>>
>> (minion1@REDACTED)5>
>>
>>
>>
>> My code looks like following and it works correctly when both server and
>> minion are on same node
>>
>> -module(kvs).
>> -author("harith").
>>
>> %% API
>> -export([start/0, store/2, lookup/1]).
>>
>> start() ->
>>   register(kvs, spawn(fun() -> loop() end)).
>>
>> store(Key, Value) ->
>>   rpc({store, Key, Value}).
>>
>> lookup(Key) ->
>>   rpc({lookup, Key}).
>>
>> rpc(Q) ->
>>   kvs ! {self(), Q},
>>   receive
>>     {kvs, Reply} ->
>>       Reply
>>   end.
>>
>> loop() ->
>>   receive
>>     {From, {store, Key, Value}} ->
>>       put(Key, {ok, Value}),
>>       From ! {kvs, true},
>>       loop();
>>     {From, {lookup, Key}} ->
>>       From ! {kvs, get(Key)},
>>       loop()
>>   end.
>>
>>
>> What am I missing here?
>>
>> Thanks
>> + Harit
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150119/d8e718d9/attachment.htm>


More information about the erlang-questions mailing list