Global names of hidden node

Yoshi hirotnkg@REDACTED
Sun Sep 5 08:02:43 CEST 2010


Is there any way to make global registered names of hidden node
visible after I connect to the hidden node from other hidden node?

In my distributed Erlang network, I don't want nodes connect
transitively and using -hidden flag, but this leads to the situation I
cannot use globally registered names on other nodes even after I
connect to those nodes using net_kernel:connect_node/1.

For example, when I start a node, with -hidden flag, I cannot see the
global registered names on 'node_foo@REDACTED' even after I connect to it

    hiro@REDACTED:~$ erl -pa ebin -hidden -setcookie harmonia_cookie -sname
    Erlang R13B04 (erts-5.7.5) [source] [rq:1] [async-threads:0]

    Eshell V5.7.5  (abort with ^G)
    (bar_node@REDACTED)1> global:registered_names().
    (bar_node@REDACTED)2> net_kernel:connect_node(node_foo@REDACTED).
    (bar_node@REDACTED)3> global:registered_names().

It seems I can use rpc:call/4 and global:register_name/2 in order to
do what I want:

    (bar_node@REDACTED)4> rpc:call(node_foo@REDACTED, global, registered_names,
    (bar_node@REDACTED)5> Pid = rpc:call(node_foo@REDACTED, global,
whereis_name, [hm_router_foo]).
    (bar_node@REDACTED)6> global:register_name(hm_router_foo, Pid).
    (bar_node@REDACTED)8> gen_server:call({global, hm_router_foo},
{find_successor, 38, nil}).

But is this a proper way and is there a better way? Or I should not
consider to do this in the first place?

Thank you

More information about the erlang-questions mailing list