Feng 10 лет назад
Родитель
Сommit
20384de0ef
3 измененных файлов с 7 добавлено и 5 удалено
  1. 6 0
      rel/files/emqttd
  2. 0 5
      rel/files/vm.args
  3. 1 0
      rel/reltool.config

+ 6 - 0
rel/files/emqttd

@@ -20,6 +20,7 @@ RUNNER_BASE_DIR={{runner_base_dir}}
 RUNNER_ETC_DIR={{runner_etc_dir}}
 RUNNER_LIB_DIR={{platform_lib_dir}}
 RUNNER_LOG_DIR={{runner_log_dir}}
+RUNNER_DATA_DIR=$RUNNER_BASE_DIR/data
 RUNNER_PLUGINS_DIR=$RUNNER_BASE_DIR/plugins
 
 # Note the trailing slash on $PIPE_DIR/
@@ -72,6 +73,8 @@ if [ -z "$NAME_ARG" ]; then
     echo "vm.args needs to have either -name or -sname parameter."
     exit 1
 fi
+NAME_ARR=(${NAME_ARG// / })
+NODE_NAME=${NAME_ARR[1]}
 
 # Extract the target cookie
 COOKIE_ARG=`grep '^\-setcookie' $RUNNER_ETC_DIR/vm.args`
@@ -264,9 +267,12 @@ case "$1" in
         BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin
         EMU=beam
         PROGNAME=`echo $0 | sed 's/.*\///'`
+        # Setup Mnesia Dir
+        MNESIA_DIR="$RUNNER_DATA_DIR/mnesia/$NODE_NAME"
         CMD="$BINDIR/erlexec -boot $RUNNER_BASE_DIR/releases/$APP_VSN/$SCRIPT \
             -embedded -config $RUNNER_ETC_DIR/emqttd.config \
             -pa $RUNNER_LIB_DIR/basho-patches \
+            -mnesia dir "\"${MNESIA_DIR}\"" \
             -args_file $RUNNER_ETC_DIR/vm.args -- ${1+"$@"}"
         export EMU
         export ROOTDIR

+ 0 - 5
rel/files/vm.args

@@ -6,11 +6,6 @@
 ## Cookie for distributed erlang
 -setcookie emqttdsecretcookie
 
-##-------------------------------------------------------------------------
-## Mnesia dir. NOTICE: quote the dir with '" "'
-##-------------------------------------------------------------------------
--mnesia dir '"data/mnesia"'
-
 ##-------------------------------------------------------------------------
 ## Flags
 ##-------------------------------------------------------------------------

+ 1 - 0
rel/reltool.config

@@ -73,6 +73,7 @@
            {mkdir, "etc/"},
            {mkdir, "etc/ssl/"},
            {mkdir, "data/"},
+           {mkdir, "data/mnesia"},
            {mkdir, "plugins/"},
            {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
            {template, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},