erlang分布式的一些参数proto_dist和no_epmd

转载:http://www.erlang.org/doc/apps/erts/alt_dist.html

To test the distribution, one can use the net_kernel:start/1 function, which is useful as it starts the distribution on a running system, where tracing/debugging can be performed. The net_kernel:start/1 routine takes a list as its single argument. The lists first element should be the node name (without the "@hostname") as an atom, and the second (and last) element should be one of the atoms shortnames or longnames. In the example case shortnames is preferred.

For net kernel to find out which distribution module to use, the command line argument -proto_dist is used. The argument is followed by one or more distribution module names, with the "_dist" suffix removed, i.e. uds_dist as a distribution module is specified as -proto_dist uds.

If no epmd (TCP port mapper daemon) is used, one should also specify the command line option -no_epmd, which will make Erlang skip the epmd startup, both as a OS process and as an Erlang ditto.

The path to the directory where the distribution modules reside must be known at boot, which can either be achieved by specifying -pa <path> on the command line or by building a boot script containing the applications used for your distribution protocol (in the uds_dist protocol, it's only the uds_dist application that needs to be added to the script).

The distribution will be started at boot if all the above is specified and an -sname <name> flag is present at the command line, here follows two examples:

$ erl -pa $ERL_TOP/lib/kernel/examples/uds_dist/ebin -proto_dist uds -no_epmd
Erlang (BEAM) emulator version 5.0 
 
Eshell V5.0  (abort with ^G)
1> net_kernel:start([bing,shortnames]).
{ok,<0.30.0>}
(bing@hador)2>

...

$ erl -pa $ERL_TOP/lib/kernel/examples/uds_dist/ebin -proto_dist uds \ 
      -no_epmd -sname bong
Erlang (BEAM) emulator version 5.0 
 
Eshell V5.0  (abort with ^G)
(bong@hador)1>

One can utilize the ERL_FLAGS environment variable to store the complicated parameters in:

$ ERL_FLAGS=-pa $ERL_TOP/lib/kernel/examples/uds_dist/ebin \ 
      -proto_dist uds -no_epmd
$ export ERL_FLAGS
$ erl -sname bang
Erlang (BEAM) emulator version 5.0 
 
Eshell V5.0  (abort with ^G)
(bang@hador)1>

The ERL_FLAGS should preferably not include the name of the node.

你可能感兴趣的:(erlang,command,Module,application,Parameters,bing)