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().
[]

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).

Hmm, I was supposed to add functionality for disconnect of a node from a cluster without triggering further disconnects, but forgot about it. I’ll soon make a pull request available implementing this. It should at least be ready for inclusion in OTP 25.1.

I’ve made a pull request #6264 implementing this now. Note that it has not been written in stone yet, and that it hasn’t been much tested yet.

It has been merged into the maint branch now, so it will be part of OTP 25.1 that is about to be released later this month.