[erlang-questions] beginner: how: mnesia dir using slave:start()
Jonathan Grot
jgrot@REDACTED
Sat Oct 27 20:52:13 CEST 2007
Minor correction: the manual page I am quoting is the slave manual, not the mnesia manual.
-Jon
----- Original Message ----
From: Jonathan Grot <jgrot@REDACTED>
To: erlang-questions@REDACTED
Sent: Saturday, October 27, 2007 12:25:17 PM
Subject: [erlang-questions] beginner: how: mnesia dir using slave:start()
Hello all,
I am trying to set the mnesia directory on a slave node in a way
similar to the method suggested by the mnesia manual page:
Quoting the manual:
E = " -env DISPLAY " ++ net_adm:localhost() ++ ":0 ",
Arg = "-mnesia_dir " ++ M ++ " -pa " ++ Dir ++ E,
slave:start(H, Name, Arg).
The slave node gets launched as if I didn't specify a directory; i.e.
it creates a directory in the CWD. I also tried a few alternatives
with no success.
As a workaround, I wrote a shell script to launch the remote node using
ssh. This is okay, but I would like the option of using the slave
module. Any remedies?
Thanks!
Here is my test program:
=============================================
-module(test_mnesia2).
-export([run/1]).
run(Which)->
% Report local mnesia directory
LocalMdir = mnesia:system_info(directory),
io:format("-----------------LOCAL
MDIR--------------------~n~p~n",[LocalMdir]),
% Choose launch method
case Which of
1 ->
% Method suggested by mnesia manual
slave:start(christina,b,"-mnesia_dir /tmp/MDB");
2 ->
% Try to launch like on command line
slave:start(christina,b,"-mnesia dir /tmp/MDB");
3 ->
% Try again to launch like on command line
slave:start(christina,b,"-mnesia dir \"/tmp/MDB\"")
end,
% Report remote mnesia directory
RemoteMdir = rpc:call(b@REDACTED,mnesia,system_info,[directory]),
io:format("-----------------REMOTE
MDIR-------------------~n~p~n",[RemoteMdir]),
% Kill remote node
slave:stop(b@REDACTED),
io:format("-----------------------------------------------~n").
=============================================
I launch the local shell with:
> erl -sname a -mnesia dir '"/tmp/MDB"'
And run my three cases:
(a@REDACTED)80> test_mnesia2:run(1).
-----------------LOCAL MDIR--------------------
"/tmp/MDB"
-----------------REMOTE MDIR-------------------
"/raid1/jgrot/erlang/Mnesia.b@REDACTED"
-----------------------------------------------
ok
(a@REDACTED)81> test_mnesia2:run(2).
-----------------LOCAL MDIR--------------------
"/tmp/MDB"
-----------------REMOTE MDIR-------------------
{badrpc,{'EXIT',{aborted,{aborted,{application_load_error,
{bad_environment_value,"/tmp/MDB"}}}}}}
=ERROR REPORT==== 27-Oct-2007::12:05:22 ===
application_controller: syntax error before: '/': /tmp/MDB
-----------------------------------------------
ok
(a@REDACTED)82> test_mnesia2:run(3).
-----------------LOCAL MDIR--------------------
"/tmp/MDB"
-----------------REMOTE MDIR-------------------
{badrpc,{'EXIT',{aborted,{aborted,{application_load_error,
{bad_environment_value,"/tmp/MDB"}}}}}}
=ERROR REPORT==== 27-Oct-2007::12:05:25 ===
application_controller: syntax error before: '/': /tmp/MDB
-----------------------------------------------
ok
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
erlang-questions mailing list
erlang-questions@REDACTED
http://www.erlang.org/mailman/listinfo/erlang-questions
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the erlang-questions
mailing list