Distributed Erlang embeded startup problem

Eranga Udesh eudesh@REDACTED
Fri Jul 1 06:51:01 CEST 2005


Hi,

I have created a target system. It's a distributed system, having 2
optional nodes, if one failes application failover to the other node.
If the high priority node comes alive it takes over.

Attached files are,
sys.config - configuration file in one node. The other node's file
just have the name of this node in "sync_nodes_optional"
esme.system - Linux init file

The init file is located at /etc/rc.d/init.d and in linked to
/etc/rc.d/rc3.d/S91esme.system

When I ran init files manually, the system starts well. When a node
fails, it fall backs and everything works smoothly.

But when I restart both systems, once they come up, I see both are
running the same application.

When I ran the nodes() in one node, I can see that it has connected to
other node too.

What puzzeling me is, why it runs correctly when I ran manually and
why it doesn't in a system reboot.

Please help.

Thanks in advance,
- Eranga
-------------- next part --------------
%% This file is identified via the erl command line option -config File.
%% Note that File should have no extension, e.g.
%% erl -config .../sys (if this file is called sys.config)
%%
%% In this file, you can redefine application environment variables.
%% This way, you don't have to modify the .app files of e.g. OTP applications.
%%
%% For this example, we set the kernel environment variables for 
%% the distributed application controller. In order to run this
%% example on your machine, you must change the node names below.
%% See erl -man application for a thorough description of what is
%% possible to configure.
[{kernel,
  [{distributed, [{omni_esme, 5000, [omni_esme@REDACTED, omni_esme@REDACTED]}]},
   {start_dist_ac, true},
   {sync_nodes_mandatory, []},
   {sync_nodes_optional, [omni_esme@REDACTED]},
   {sync_nodes_timeout, 5000}]}].
-------------- next part --------------
#!/bin/sh
#  
#  File name:  S75otp.system
#  Purpose:    Automatically starts Erlang and applications when the 
#              system starts
#  Author:     
#  Resides in: /etc/rc3.d/init.d
#

MYNAME=`basename $0`
ALLARGS=$*

ROOTDIR=/usr2/omni_esme
NODE_NAME=omni_esme
MNESIA_DIR=$ROOTDIR/db
PIPEDIR=$ROOTDIR/pipe/
LOGDIR=$ROOTDIR/logs
RELEASEDIR=$ROOTDIR/system
COOKIE=wavenetlk
ERL=$RELEASEDIR/bin/erl
ERL_TOP=$RELEASEDIR
RUN_USER=root
NUM_THREADS=4

RUN_ERL_LOG_GENERATIONS=5
RUN_ERL_LOG_MAXSIZE=10000000
HEART_COMMAND="/etc/rc.d/init.d/$MYNAME $ALLARGS"
HEART_BEAT_TIMEOUT=30
HEART_BEAT_BOOT_DELAY=10
TERM=sun
export RUN_ERL_LOG_GENERATIONS RUN_ERL_LOG_MAXSIZE HEART_COMMAND HEART_BEAT_TIMEOUT HEART_BEAT_BOOT_DELAY TERM ERL_TOP

if [ ! -d /usr/bin ]
then                    # /usr not mounted
        exit
fi

if test ! -d $RELEASEDIR
then
    echo "Release directory does not exist ($RELEASEDIR)"
    exit
fi

if test ! -d $PIPEDIR
then
    echo "Pipe directory does not exist."
    mkdir $PIPEDIR
else
    echo "Pipe directory already exists."
fi

if test ! -d $LOGDIR
then
    echo "Log directory does not exist. Create a new one."
    mkdir $LOGDIR
else
    echo "Log directory already exists."
fi

if [ -z "$RELDIR" ]
then
   RELDIR=$RELEASEDIR/releases
fi

START_ERL_DATA=$RELDIR/start_erl.data

killproc() {            # kill the named process(es)
	echo "Killing $1."
  pid=`pidof $1`
  [ "$pid" != "" ] && kill $pid
}

# Start/stop processes required for Erlang

case $1 in

  start)
		echo  "Starting ISUP STP"
		echo $RELEASEDIR/bin/run_erl -daemon $PIPEDIR $LOGDIR "$RELEASEDIR/bin/start_erl $RELEASEDIR $RELDIR $START_ERL_DATA \
				-heart -sname $NODE_NAME -mnesia dir '\"$MNESIA_DIR\"' +A$NUM_THREADS -setcookie $COOKIE".
		$RELEASEDIR/bin/run_erl -daemon $PIPEDIR $LOGDIR "$RELEASEDIR/bin/start_erl $RELEASEDIR $RELDIR $START_ERL_DATA \
				-heart -sname $NODE_NAME -mnesia dir '\"$MNESIA_DIR\"' +A$NUM_THREADS -setcookie $COOKIE" 
    ;;
 
  debug)
		echo  "Starting ISUP STP in debug mode"
    $RELEASEDIR/bin/start_erl $RELEASEDIR $RELDIR $START_ERL_DATA \
				-sname $NODE_NAME -mnesia dir '"$MNESIA_DIR"' +A$NUM_THREADS -setcookie $COOKIE
    ;;
 
  stop)
    echo "Stopping ISUP STP"
    #$ERL -noshell -sname isupstp_stopper -pa $PA \
    #       -s web_server stop webserver001@$HOSTNAME
    killproc heart
    ;;
 
  *)
    echo "Usage: $0 {start|stop|debug}"
    exit 1
esac
 
exit 0




More information about the erlang-questions mailing list