1-to-1 connections & possibly hidden nodes
Michael Truog
mjtruog@REDACTED
Tue Jul 13 07:40:11 CEST 2021
On 7/12/21 3:02 PM, Roberto Ostinelli wrote:
>
> 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
>
>
Hi Roberto,
It is best if you have the kernel app 'dist_auto_connect' setting set to
'never' if you want to ensure each node connection is created
programmatically (to avoid unintended node connections due to
messages). The function net_kernel:connect_node/1 is creating a visible
node connection, ensuring that your connection makes your node part of
the fully connected set of visible nodes. If you used
net_kernel:hidden_connect_node/1 a hidden node connection would be
created and you will not get any additional node connections from that
function call. However, net_kernel:hidden_connect_node/1 remains
undocumented so it isn't clearly part of the public interface. CloudI
(https://cloudi.org) uses it and it is the preferred function for
connecting to an Erlang node from a script, so I would like to think the
function isn't disappearing in the future.
Best Regards,
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20210712/d941a3ee/attachment.htm>
More information about the erlang-questions
mailing list