Bridging two distributed Erlang node groups ?

Mickael Remond mickael.remond@REDACTED
Fri Feb 6 18:24:26 CET 2004


* Nigel.Head@REDACTED <Nigel.Head@REDACTED> [2004-02-06 16:42:17 +0100]:

> Assorted Guru's:
> 
> Suppose I have two groups of Erlang nodes, each with their own cookie, is there
> a neat way to bridge the gap and do things like use pman/appmon/rpc on nodes in
> the first group to monitor/control/access the nodes of the second group?
> 
> The scenario behind this is that I am considering a case where I would have an
> embedded, distributed application on node set #1, with a matching monitor and
> control application on node set #2, but with the two sets of nodes separated by
> a very high latency, low throughput point-to-point link (like worst case 500
> seconds, 4 kbits/sec :-) which I believe precludes making the two nodes groups
> all part of one distributed system as it would forever appear to be a
> partitioned network.
> 
> If need be I could do a gen_tcp type thing (or similar for the appropriate
> point-to-point protocol) and explicitly shift erlang terms to and fro between
> two gateway processes, but I'd prefer for the built in tools to work, if that is
> possible. Apart maybe from the extreme latency I can't really imagine that this
> sort of scenario hasn't been tackled before ....
> 
> Suggestions or just musings are welcome,

You can do that by setting on a given node, different cookie for
different node. You can use auth:set_cookie(Node, Cookie) to partition
your Erlang cluster.

For example, start 3 nodes, each on with different cookies. You can then
assign a cookie on node 1 to connect to node 2 (Use the node 2 cookie):

 (node1@REDACTED)1> auth:set_cookie(node2@REDACTED, node2).

You can then ping node2 from node1:

 (node1@REDACTED)12> net_adm:ping(node2@REDACTED).
 pong

Do the same from node3:

 (node3@REDACTED)1> auth:set_cookie(node2@REDACTED, node2).
 (node3@REDACTED)2> net_adm:ping(node2@REDACTED).

The erlang cluster is partitionned: node1 and node3 only knows about node2.
node2 knows about node1 _and_ node3. Use the function nodes() on each
node to list the known nodes. For example:

(node2@REDACTED)4> nodes().
[node1@REDACTED,node3@REDACTED]

I hope this helps.

-- 
Mickaël Rémond
 http://www.erlang-projects.org/



More information about the erlang-questions mailing list