erlang的epmd

epmd有一个-stop的选项,当要是用
$epmd -stop name

的时候,本机启动的第一个erlang shell时要加上-relaxed_command_check选项,例如:
erl -sname -epmd "epmd -relaxed_command_check -daemon"

这样的话,就会实现如下效果:
[liufan@liufan ~]$ erl -sname a -epmd "epmd -relaxed_command_check -daemon"
Erlang R16B01 (erts-5.10.2) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V5.10.2  (abort with ^G)
(a@liufan)1> 

[liufan@liufan ~]$ epmd -names
epmd: up and running on port 4369 with data:
name a at port 34772
[liufan@liufan ~]$ ps -ef | grep epmd
liufan    4198     1  0 04:14 ?        00:00:00 epmd -relaxed_command_check -daemon
liufan    4318  3991  0 04:21 pts/4    00:00:00 grep epmd
[liufan@liufan ~]$ epmd -stop a
STOPPED
[liufan@liufan ~]$ epmd -names
epmd: up and running on port 4369 with data:
[liufan@liufan ~]$ 

而当启动的第一个erlang shell没用使用-relaxed_command_check选项时,则使用epmd -stop name则会报错,例子如下:
[liufan@liufan ~]$ erl -sname a
Erlang R16B01 (erts-5.10.2) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V5.10.2  (abort with ^G)
(a@liufan)1> 

[liufan@liufan ~]$ erl -sname b -epmd "epmd -relaxed_command_check -daemon"
Erlang R16B01 (erts-5.10.2) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V5.10.2  (abort with ^G)
(b@liufan)1> 

[liufan@liufan ~]$ epmd -names
epmd: up and running on port 4369 with data:
name b at port 41042
name a at port 33383
[liufan@liufan ~]$ ps -ef | grep epmd
liufan    4430     1  0 04:25 ?        00:00:00 /usr/local/lib/erlang/erts-5.10.2/bin/epmd -daemon
liufan    4478  3991  0 04:26 pts/4    00:00:00 grep epmd
[liufan@liufan ~]$ epmd -stop a
epmd: local epmd responded with <>
[liufan@liufan ~]$ epmd -names
epmd: up and running on port 4369 with data:
name b at port 41042
name a at port 33383
[liufan@liufan ~]$ 


注意:当实验完第一个例子之后,要用kill杀掉epmd的进程,再实现第二个例子

你可能感兴趣的:(erlang,epmd)