From 68d53c01b0b8e9a007a6a30158c19e34b2d2a34e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 18 May 2016 15:53:35 +0200 Subject: Update STDLIB documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Language cleaned up by the technical writers xsipewe and tmanevik from Combitech. Proofreading and corrections by Björn Gustavsson and Hans Bolinder. --- lib/stdlib/doc/src/slave.xml | 202 +++++++++++++++++++++++-------------------- 1 file changed, 106 insertions(+), 96 deletions(-) (limited to 'lib/stdlib/doc/src/slave.xml') diff --git a/lib/stdlib/doc/src/slave.xml b/lib/stdlib/doc/src/slave.xml index 244822568b..e53ec8231b 100644 --- a/lib/stdlib/doc/src/slave.xml +++ b/lib/stdlib/doc/src/slave.xml @@ -29,89 +29,139 @@ slave - Functions to Starting and Controlling Slave Nodes + Functions for starting and controlling slave nodes. +

This module provides functions for starting Erlang slave nodes. - All slave nodes which are started by a master will terminate - automatically when the master terminates. All TTY output produced - at the slave will be sent back to the master node. File I/O is - done via the master.

+ All slave nodes that are started by a master terminate + automatically when the master terminates. All terminal output produced + at the slave is sent back to the master node. File I/O is + done through the master.

+

Slave nodes on other hosts than the current one are started with - the program rsh. The user must be allowed to rsh to + the rsh program. The user must be allowed to rsh to the remote hosts without being prompted for a password. This can - be arranged in a number of ways (refer to the rsh - documentation for details). A slave node started on the same host + be arranged in a number of ways (for details, see the rsh + documentation). A slave node started on the same host as the master inherits certain environment values from the master, such as the current directory and the environment variables. For what can be assumed about the environment when a slave is started - on another host, read the documentation for the rsh + on another host, see the documentation for the rsh program.

+

An alternative to the rsh program can be specified on - the command line to erl as follows: -rsh Program.

-

The slave node should use the same file system at the master. At - least, Erlang/OTP should be installed in the same place on both - computers and the same version of Erlang should be used.

-

Currently, a node running on Windows NT can only start slave + the command line to + erl(1) as follows:

+ +
+-rsh Program
+ +

The slave node is to use the same file system at the master. At + least, Erlang/OTP is to be installed in the same place on both + computers and the same version of Erlang is to be used.

+ +

A node running on Windows can only start slave nodes on the host on which it is running.

+

The master node must be alive.

+ + + pseudo([Master | ServerList]) -> ok + Start a number of pseudo servers. + + Master = node() + ServerList = [atom()] + + +

Calls pseudo(Master, ServerList). If you want to start + a node from the command line and set up a number of pseudo + servers, an Erlang runtime system can be started as follows:

+
+% erl -name abc -s slave pseudo klacke@super x --
+
+
+ + + + Start a number of pseudo servers. + +

Starts a number of pseudo servers. A pseudo server is a + server with a registered name that does nothing + but pass on all message to the real server that executes at a + master node. A pseudo server is an intermediary that only has + the same registered name as the real server.

+

For example, if you have started a slave node N and + want to execute pxw graphics code on this node, you can + start server pxw_server as a pseudo server at + the slave node. This is illustrated as follows:

+ +rpc:call(N, slave, pseudo, [node(), [pxw_server]]). +
+
+ + + + Run a pseudo server. + +

Runs a pseudo server. This function never returns any value + and the process that executes the function receives + messages. All messages received are simply passed on to + Pid.

+
+
+ - Start a slave node on a host + Start a slave node on a host. -

Starts a slave node on the host Host. Host names need - not necessarily be specified as fully qualified names; short +

Starts a slave node on host Host. Host names + need not necessarily be specified as fully qualified names; short names can also be used. This is the same condition that applies to names of distributed Erlang nodes.

-

The name of the started node will be Name@Host. If no - name is provided, the name will be the same as the node which - executes the call (with the exception of the host name part of - the node name).

+

The name of the started node becomes + Name@Host. If no + name is provided, the name becomes the same as the node that + executes the call (except the host name part of the node name).

The slave node resets its user process so that all - terminal I/O which is produced at the slave is automatically - relayed to the master. Also, the file process will be relayed + terminal I/O that is produced at the slave is automatically + relayed to the master. Also, the file process is relayed to the master.

-

The Args argument is used to set erl command - line arguments. If provided, it is passed to the new node and - can be used for a variety of purposes. See - erl(1)

-

As an example, suppose that we want to start a slave node at - host H with the node name Name@H, and we also +

Argument Args is used to set erl + command-line arguments. If provided, it is passed to the new + node and can be used for a variety of purposes; see + erl(1).

+

As an example, suppose that you want to start a slave node at + host H with node name Name@H and want the slave node to have the following properties:

- -

directory Dir should be added to the code path;

-
- -

the Mnesia directory should be set to M;

-
- -

the unix DISPLAY environment variable should be - set to the display of the master node.

-
+ Directory Dir is to be added to the code path. + The Mnesia directory is to be set to M. + The Unix DISPLAY environment variable is to be + set to the display of the master node.

The following code is executed to achieve this:

E = " -env DISPLAY " ++ net_adm:localhost() ++ ":0 ", Arg = "-mnesia_dir " ++ M ++ " -pa " ++ Dir ++ E, slave:start(H, Name, Arg). -

If successful, the function returns {ok, Node}, - where Node is the name of the new node. Otherwise it - returns {error, Reason}, where Reason can be - one of:

+

The function returns {ok, Node}, where + Node is the name of the new node, otherwise + {error, Reason}, where Reason + can be one of:

timeout

The master node failed to get in contact with the slave - node. This can happen in a number of circumstances:

+ node. This can occur in a number of circumstances:

- Erlang/OTP is not installed on the remote host - the file system on the other host has a different - structure to the the master - the Erlang nodes have different cookies. + Erlang/OTP is not installed on the remote host. + The file system on the other host has a different + structure to the the master. + The Erlang nodes have different cookies.
no_rsh @@ -120,75 +170,35 @@ slave:start(H, Name, Arg). {already_running, Node} -

A node with the name Name@Host already exists.

+

A node with name Name@Host + already exists.

+ - Start and link to a slave node on a host + Start and link to a slave node on a host.

Starts a slave node in the same way as start/1,2,3, except that the slave node is linked to the currently executing process. If that process terminates, the slave node also terminates.

-

See start/1,2,3 for a description of arguments and - return values.

+

For a description of arguments and return values, see + start/1,2,3.

+ - Stop (kill) a node + Stop (kill) a node.

Stops (kills) a node.

- - pseudo([Master | ServerList]) -> ok - Start a number of pseudo servers - - Master = node() - ServerList = [atom()] - - -

Calls pseudo(Master, ServerList). If we want to start - a node from the command line and set up a number of pseudo - servers, an Erlang runtime system can be started as - follows:

-
-% erl -name abc -s slave pseudo klacke@super x --
-
-
- - - Start a number of pseudo servers - -

Starts a number of pseudo servers. A pseudo server is a - server with a registered name which does absolutely nothing - but pass on all message to the real server which executes at a - master node. A pseudo server is an intermediary which only has - the same registered name as the real server.

-

For example, if we have started a slave node N and - want to execute pxw graphics code on this node, we can - start the server pxw_server as a pseudo server at - the slave node. The following code illustrates:

- -rpc:call(N, slave, pseudo, [node(), [pxw_server]]). -
-
- - - Run a pseudo server - -

Runs a pseudo server. This function never returns any value - and the process which executes the function will receive - messages. All messages received will simply be passed on to - Pid.

-
-
-- cgit v1.2.3