启动没有epmd的erlang VM [英] Starting the erlang VM without epmd

查看:111
本文介绍了启动没有epmd的erlang VM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从erlang vm分别启动epmd,以便对连接处理进行监控。

I'm trying to startup epmd separately from the erlang vm, in order to do monitoring on the connection handling.

这个工作正常,除了vm在epmd之前启动。

This works fine, except for cases when the vm starts up before epmd.

有没有办法让erlang vm自行启动epmd?

Is there a way to make the erlang vm start without it starting the epmd on its own?

推荐答案

可能有用的问题/答案:

Possible helpful questions/answers:

  • Is there a way to stop Erlang servers from automatically starting epmd?
  • Ensure epmd started

所以根据这些问题/答案,我建议使erlang vm服务依赖于epmd(这应该是另一个服务)。另外,如果您运行epmd作为您运行的第一个服务之一,那么应该可以在每次erlang之前启动它。但是如何做到这一点实际上取决于您的操作系统和部署实现细节。

So inline with those questions/answers, I'd suggest to make the erlang vm service depend on epmd (which should be another service on its own). Also, if you run epmd as one of your very first services to run, it should be possible to make it start before erlang every time. But how to do this will actually depend on your operating system and deployment implementation details.

另外,一个不太优雅的解决方案是更改您的init脚本,所以它会等待epmd启动,但是手动启动。您的里程可能会有所不同,而且非常天真的方法(但作为示例有用)将如下所示:

Also, a not-so-elegant solution, would be to change your init script, so it will wait for epmd to start, but manually. Your mileage may vary, and a very naive approach (but useful as an example) would be something like:

    while [ true ]; do
      pid=`pidof epmd`;
      if [ "$pid" == "" ]; then
        sleep 1; # Wait a bit more
      else
        break;
      fi
    done
    # Continue initialization

请注意,代码应该考虑最大的尝试次数,pidof只适用于linux等。不知道我喜欢这个解决方案,但可以做这个工作。

Note that the code should contemplate a maximum number of attempts, also pidof only works on linux, etc. Not sure I like this solution, but can do the job.

而且优雅的解决方案你可以用你自己的二进制代替erlang来运行的epmd,这样你就可以做任何你所需要的(比如像上面的代码一样伪装epmd开始或运行你自己的)。

And as less elegant solutions, you could replace the epmd that erlang will run with a binary of your own, that does whatever you need (like faking the epmd start or running your own, like in the code above).

希望它有帮助!

这篇关于启动没有epmd的erlang VM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆