Erlang: How to remove node from nodes of other nodes ()?

I want to simulate the behavior of erl -sname example -hidden , but dynamically. How can I remove a node from visibility in a cluster?

See @mwt's comments on @Yasir Arsanukaev for further clarification of what I'm trying to do.

+4
source share
1 answer

Try erlang:disconnect_node/1 :

 ( bar@dt )1> nodes(). [] ( bar@dt )2> net_adm:ping(' foo@dt '). pong ( bar@dt )3> nodes(). [ foo@dt ] ( bar@dt )4> erlang:disconnect_node(' foo@dt '). true ( bar@dt )5> nodes(). [] 

Or, if you want node to be removed from other nodes nodes() :

 ( bar@dt )1> nodes(). [ foo@dt ] ( bar@dt )2> rpc:eval_everywhere(erlang, disconnect_node, [node()]). abcast ( bar@dt )3> nodes(). [] 

If node was started using the -hidden key:

 ( bar@dt )1> nodes(hidden). [ foo@dt ] ( bar@dt )2> rpc:eval_everywhere(nodes(hidden), erlang, disconnect_node, [node()]). abcast ( bar@dt )3> nodes(hidden). [] 
+3
source

Source: https://habr.com/ru/post/1310571/


All Articles