Runtime crash detection?

1) Is there a way to automatically detect when a node crashes from another node?

2) Is there a way to automatically restart a node that just crashed?

As for my second question, I have googled and I don't see to find any mention of creating nodes from / at runtime.

I understand that you can do this with processes. Creating processes at runtime is trivial, and if you want to know when they crash, you can create them from a supervisor, etc., but I cannot find anything related to node discovery / creation.

This is for a customer who wants to develop a smaller version of Amazon EDS, but I can’t imagine that Amazon manually reloads the nodes if they go down!

+4
source share
1 answer

You can use net_kernel:monitor_nodes(true, [{node_type, visible}]) to monitor all visible nodes inside your erlang application. From the man page :

The calling process subscribes or does not subscribe to a change in the status of the nodeMessages. A node message is available for the entire subscription process when a new node is connected, and a nodedown message is delivered when a node is disconnected.

I do not see a direct method (from inside your process that receives a nodedown message) with which you can run node on a remote computer. You will probably need to write a small module that will do this automatically for you.

+3
source

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


All Articles