Besides running $ killall -9 beam.smp
, how can I kill an Erlang node programmatically when I know its -sname
?
If I don't want the heartbeat monitor to restart the process, how can I ensure that whatever answer is given for the above question will also kill the heartbeat?
Is there a decent guide to deploying Erlang as a daemon?
A process can terminate itself by calling one of the BIFs exit(Reason), erlang:error(Reason), erlang:error(Reason, Args), erlang:fault(Reason) or erlang:fault(Reason, Args). The process then terminates with reason Reason for exit/1 or {Reason,Stack} for the others.
The erlang port mapper daemon is used to coordinate distributed erlang instances. His job is to keep track of which node name listens on which address. Hence, epmd map symbolic node names to machine addresses. Default port: 4369. PORT STATE SERVICE VERSION.
EPMD (Erlang Port Mapper Daemon) messages are the messages sent between Erlang nodes and the empd process. The message formats are derived from the * lib/kernel/src/erl_epmd.* files as part of the Erlang distribution available from http://www.erlang.org/ Erlang is a functional programming language.
A node is an executing Erlang runtime system that has been given a name, using the command-line flag -name (long names) or -sname (short names). The format of the node name is an atom name@host. name is the name given by the user.
kill
and killall
with -9
is almost always wrong.
You can quite easily ask the remote node to exit using:
rpc:call(RemoteNode, init, stop, []).
I don't know whether that'd prevent heart
from restarting it, but I'd suggest that if you expect to stop it, you shouldn't run it in a don't-ever-stop mode.
Update - Zed points out that init:stop
does the right thing with heart
, so the above rpc:call
is the best and only way to do it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With