1-to-1 connections & possibly hidden nodes

Roberto Ostinelli ostinelli@REDACTED
Tue Jul 13 00:02:28 CEST 2021


Hi Stanislav,
Your suggestion seems to work. I've started 3 nodes one@ and two@ connected
in a cluster, and three@ with the option you specify. I get:

(*one*@dev.local)1> net_kernel:connect_node('two@REDACTED').
true
(*one*@dev.local)2> nodes().
['two@REDACTED']

(*two*@dev.local)1> nodes().
['one@REDACTED']

When I then connect three@ to one@:

(*three*@dev.local)1> net_kernel:connect_node('one@REDACTED').
true
(*three*@dev.local)2> nodes().
['one@REDACTED']

(*one*@dev.local)3> nodes().
['two@REDACTED','three@REDACTED']

While two@ doesn't change:

(*two*@dev.local)2> nodes().
['one@REDACTED']


What is the advantage over using a hidden node? Here below is the output
with one@ and two@ in a full cluster, while three@ has been started with
the -hidden option and has been connected only to one@:

(*one*@dev.local)1> nodes().
['two@REDACTED']
(*one*@dev.local)2> nodes(hidden).
['three@REDACTED']
(*one*@dev.local)3> register(shell, self()).
true

(*two*@dev.local)1> nodes().
['one@REDACTED']
(*two*@dev.local)2> nodes(hidden).
[]

(*three*@dev.local)1> {shell, 'one@REDACTED'} ! hello.
hello

(*one*@dev.local)4> flush().
Shell got hello
ok


Thank you for your help!
r.


On Mon, Jul 12, 2021 at 8:54 PM Stanislav Ledenev <s.ledenev@REDACTED>
wrote:

> If I understand you correctly, erl -connect_all false is what you need.
>
> пн, 12 июл. 2021 г. в 21:27, Roberto Ostinelli <ostinelli@REDACTED>:
>
>> ...And of course the diagram would be (without the copy-pasta issues):
>>
>> <NODE A in cluster> --------- <NODE C in cluster>
>>         \                     /
>>          \                   /
>>           \                 /
>>           <NODE B in cluster>
>>            *       *       *
>>           *        *        *
>>          *         *         *
>>       <NODE B1> <NODE B2> <NODE B3>
>>
>>
>> On Mon, Jul 12, 2021 at 8:24 PM Roberto Ostinelli <ostinelli@REDACTED>
>> wrote:
>>
>>> All,
>>> Is it possible to have a 1-to-1 connection from a node in a cluster to a
>>> single Erlang node which does _not_ connect to the mesh, but only to a very
>>> specific Erlang node?
>>>
>>> I've go a very CPU-heavy application and am trying to find ways to
>>> offload the CPU computations to Erlang nodes (tha don't need to be in a
>>> cluster, except for a single box they refer to).
>>>
>>> Basically something like this:
>>>
>>> <NODE A in cluster> --------- <NODE B in cluster>
>>>         \                     /
>>>          \                   /
>>>           \                 /
>>>           <NODE B in cluster>
>>>            *       *       *
>>>           *        *        *
>>>          *         *         *
>>>       <NODE B1> <NODE B2> <NODE B>
>>>
>>> The distributed cluster is composed of nodes A, B and C, but nodes B1,
>>> B2 and B3 can communicate directly with node B and that node only. Node B
>>> can offload CPU computations to B1, B2, B3 by sending erlang messages to
>>> them and receive results back.
>>>
>>> Every node in the cluster needs ~50x the CPU power, therefore I'm trying
>>> to avoid having the standard cluster grow so big that it would be
>>> generating way too much noise in a full mesh network (especially since it
>>> really isn't needed).
>>>
>>> I can of course use a simple custom TCP binary channel, but was
>>> wandering if something already exists that I could leverage. I've seen that
>>> hidden nodes "Hidden nodes always establish hidden connections to all other
>>> nodes except for nodes in the same global group" [1] so if I understand
>>> this correctly nodes B1-3 would still connect to A and B, even though the
>>> cluster wouldn't know about them.
>>>
>>> Thank you for any considerations you might have,
>>> r.
>>>
>>>  [1] http://erlang.org/doc/man/erl.html
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20210713/44b829a0/attachment.htm>


More information about the erlang-questions mailing list