简体   繁体   English

如何重启erlang节点?

[英]How to restart an erlang node?

A sample I have git push github我有一个示例 git push github

It is an example of application from the book Programming Erlang这是编程 Erlang 一书中的一个应用示例

you can do followREADME.md你可以按照README.md

My question is when the application sellaprime started, and I我的问题是应用程序 sellaprime 何时开始,我

./bin/sp restart

this will make the node down and not restart?这将使节点关闭而不是重新启动?

Erlang Doc say Erlang Doc

The system is restarted inside the running Erlang node, which means that the emulator is not restarted.系统在运行的 Erlang 节点重新启动,这意味着模拟器没有重新启动。 All applications are taken down smoothly, all code is unloaded, and all ports are closed before the system is booted again in the same way as initially started.所有应用程序都被顺利删除,所有代码被卸载,所有端口都被关闭,然后系统以与初始启动相同的方式再次启动。 The same BootArgs are used again.再次使用相同的 BootArgs。

What does "emulator is not restarted" mean? “模拟器未重启”是什么意思?

If I want to restart a node, what is the right way to do?如果我想重启一个节点,正确的做法是什么?

By the way, is there any API to know the current release version, like顺便说一句,是否有任何 API 可以知道当前的发布版本,例如

application:which_applications()

It looks like your sb init script, that is using the nodetool script should call init:restart() for you.它看起来像您的sb init 脚本,即使用nodetool脚本应该为您调用init:restart() If this is done, but your node is instead shut down, check your logs for any possible errors (perhaps one of your applications cannot handle a restart?).如果这样做了,但您的节点反而关闭了,请检查您的日志是否有任何可能的错误(也许您的应用程序之一无法处理重新启动?)。

Using init:restart() is the way to do it though.使用init:restart()是这样做的方法。 Here's an example: start an Erlang node with a name (in this case, test ):这是一个示例:使用名称(在本例中为test )启动一个 Erlang 节点:

$ erl -sname test
Erlang/OTP 18 [erts-7.0] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V7.0  (abort with ^G)
(test@host)1> hello.
hello
(test@host)2> 

Temporary start another node that will make an RPC call to the first node:临时启动另一个节点,该节点将对第一个节点进行 RPC 调用:

$ erl -sname other -noinput -noshell -eval "rpc:call('test@host', init, restart, [])" -s init stop
$

Observer the original node being restarted:观察重新启动的原始节点:

(test@host)2> Erlang/OTP 18 [erts-7.0] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V7.0  (abort with ^G)
(test@host)1>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM