什么是epmd?
Erlang是Erlang Port Mapper Daemon的缩写,是erlang集群节点间端口映射的守护进程,默认绑定在4369端口上。
集群是依靠epmd维护的,epmd负责维护集群内的节点连接,提供节点名称到IP地址及端口的解析服务,相当于一个内置的DNS服务。
在linux上它使用select,它只建短连接。
在linux上,节点的监听端口使用poll,指定+K true参数以后,会使用epoll,需要编译时打开开关。
什么时候启动epmd?
The daemon is started automatically by command erl(1) if the node is to be distributed and no running instance is present.
—— Erlang Run-Time System Application (ERTS)
run on each of the computers that are part of your Erlang cluster. EPMD will act as a name server that lets nodes register themselves, contact other nodes by name rather than port numbers, and warn you about any name clashes.
——《Learn You Some Erlang for Great Good》