Erlang Central

Difference between revisions of "ConnectingNodesByHand"

From ErlangCentral Wiki

(3 Node Cluster Example)
 
Line 8:Line 8:
  
 
# create a shell script (ANodeStart.sh) that contains the following:
 
# create a shell script (ANodeStart.sh) that contains the following:
\#
+
##
\#!/bin/bash
+
##!/bin/bash
\# Start Node A
+
HOSTNAME=`hostname`
+
HDNAME=`host ${HOSTNAME} | cut -d ' ' -f 4`
+
erl -name ANode@${HDNAME} -setcookie ACookie -mnesia dir '"~/NodeStorage/NodeA"'
+
  
5) cp ANode.sh BNode.sh
+
    HOSTNAME=`hostname`
6) sed -e 's/ANode/BNode/g'  ANode.sh > BNode.sh
+
    HDNAME=`host ${HOSTNAME} | cut -d ' ' -f 4`
7)
+
    erl -name ANode@${HDNAME} -setcookie ACookie -mnesia dir '"~/NodeStorage/NodeA"'
 +
 
 +
# cp ANode.sh BNode.sh
 +
# sed -e 's/ANode/BNode/g'  ANode.sh > BNode.sh
 +
# sed -e 's/ANode/CNode/g'  ANode.sh > CNode.sh
 +
 
 +
# Each file should now contain something like:
 +
erl (or erl.exe or werl.ex on windows) -name

Revision as of 19:36, 10 January 2007

If you wanted a simple 3 node cluster you could do the following by hand.

  1. On linux:
  1. Install erlang somewhere, say /usr/local/otp_NNN
  2. mkdir NodeStorage; mkdir NodeStorage/ANode; mkdir NodeStorage/BNode
  3. export ERL_TOP=(erlang install dir, in bash) or setenv ( csh )
  4. cd $ERL_TOP
  1. create a shell script (ANodeStart.sh) that contains the following:
    1. !/bin/bash
    HOSTNAME=`hostname`
    HDNAME=`host ${HOSTNAME} | cut -d ' ' -f 4`
    erl -name ANode@${HDNAME} -setcookie ACookie -mnesia dir '"~/NodeStorage/NodeA"'
  1. cp ANode.sh BNode.sh
  2. sed -e 's/ANode/BNode/g' ANode.sh > BNode.sh
  3. sed -e 's/ANode/CNode/g' ANode.sh > CNode.sh
  1. Each file should now contain something like:

erl (or erl.exe or werl.ex on windows) -name