Connecting cluster with different cookies
Wed Aug 11 09:10:10 CEST 2021
We use `erlang:set_cookie/2` with a remote node in Erlang LS, too. Things
can probably be refactored to avoid that, but the existing API proved to be
handy over the years.
Looking at GitHub, other projects use that API, too (e.g. redbug).
I have always been thinking (maybe erroneously) of the cookie as a property
of the "connection" between two nodes (with a default one), not a property
of the single node.
With that mindset, the `erlang:set_cookie/2` API made sense. This was
useful when building "topologies" of nodes (e.g. nodes A, B and C where B
can connect to A and C but A cannot connect to C), especially during tests.
Reflecting on this, what seems inconsistent in the API is the lack of a
`get_cookie/1` which would return the current cookie for the "connection"
from the current node's perspective (or alternatively a
`erlang:get_cookies/0` which returns all of them).
On Mon, 9 Aug 2021 at 18:21, Raimo Niskanen <
> Hello Community.
> Regarding a GitHub Issue in progress:
> and a corresponding pull request:
> There is an apparently rarely known API call
> erlang:set_cookie(Node, Cookie) that allows you to configure
> a cookie to use when communicating with a different node.
> This/these set cookie/s may/should be different from the node's
> normal (default) cookie, and the functionality exists
> to make it possible to connect nodes that have different
> default cookies.
> The feature is probably rarely used; almost nobody in the
> OTP group knew that it existed nor how it is supposed
> to be used. Connecting only nodes with the same cookie
> seems to be the norm.
> The question is now, is this an essential feature / how
> important is this feature?
> To completely remove this feature would simplify the code,
> but if that should destroy an important use case; removing
> would not be an option.
> The Issue and PR is about how it is supposed to work; if and
> how it should be fixed.
> So, what says the Community? How important feature is it
> to be able to connect nodes with different cookies?
> / Raimo Niskanen, Erlang/OTP, Ericsson AB
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions