How to disconnect a node from a fully connected cluster (on OTP 25)?

Perhaps the correct question is how to correctly configure a fully connected cluster that allows removing a node without unclustering.

Related links:

https://www.erlang.org/doc/man/global.html

OTP version: 25.0.3

Start 3 nodes:

$ erl -sname a -connect_all true
$ erl -sname b -connect_all true
$ erl -sname c -connect_all true

On node ‘a’:

> net_adm:ping('b@galaxy').
pong
> net_adm:ping('c@galaxy').
pong
> nodes().
[b@galaxy,c@galaxy]

Then remove one node:

> net_kernel:disconnect('c@galaxy').
true

On node a:

=WARNING REPORT==== 26-Jul-2022::09:13:11.249316 ===
'global' at node a@galaxy disconnected node b@galaxy in order to prevent overlapping partitions

> nodes().
[]

On node ‘b’:

=WARNING REPORT==== 26-Jul-2022::09:13:11.247809 ===
'global' at node b@galaxy requested disconnect from node c@galaxy in order to prevent overlapping partitions
=WARNING REPORT==== 26-Jul-2022::09:13:11.248548 ===
'global' at node b@galaxy requested disconnect from node a@galaxy in order to prevent overlapping partitions

> nodes().
[]

On node ‘c’:

=WARNING REPORT==== 26-Jul-2022::09:13:11.248618 ===
'global' at node c@galaxy disconnected node b@galaxy in order to prevent overlapping partitions

> nodes().
[]
1 Like

You can use erl -sname a -connect_all true -kernel prevent_overlapping_partitions false to get the compatibility behaviour. See here: Erlang -- kernel

(However it creates a sort of an undefined behaviour, because now cluster can be partially mesh-connected, which contradict global documentation, - hence prevent_overlapping_partitions is true by default since OTP 25).

2 Likes