[erlang-questions] Slave node and open file

18 views
Skip to first unread message

Bertrand Paquet

unread,
Jul 6, 2010, 11:53:05 AM7/6/10
to erlang-q...@erlang.org
Hi,

I have the following problem :

1) On master node, I start a remote erlang node with slave:start
command, using ssh
2) I spawn a process in this node
3) In the spawned process, I run inet:gethostname() command, which
give me the remote hostname -> OK
4) In the spawned process, I open /proc/sys/kernel/hostname : I get
the local hostname -> It's not that I want

Do you know :
- if this comportement is normal : a remote node started with
slave:start, which use file:open command access to master node
filesystem ?
- if there is a solution to access to the remote node file system ?

Thank you for your help.

Regards,

Bertrand

________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questio...@erlang.org

Max Lapshin

unread,
Jul 6, 2010, 1:51:44 PM7/6/10
to Bertrand Paquet, erlang-q...@erlang.org
rpc:call ?

Nicholas Frechette

unread,
Jul 6, 2010, 3:02:30 PM7/6/10
to Max Lapshin, Bertrand Paquet, erlang-q...@erlang.org
Unless I am mistaken, the erlang master/slave modules are designed such that
all IO (perhaps only file system IO) on the slave is redirected to the
master. This allows slaves to read/write to the master while doing the heavy
lifting on the remote cpu.
I'm not sure if you can access the slave's file system that way.

Bertrand Paquet

unread,
Jul 7, 2010, 2:37:09 AM7/7/10
to Nicholas Frechette, Max Lapshin, erlang-q...@erlang.org
On Tue, Jul 6, 2010 at 21:02, Nicholas Frechette <zen...@gmail.com> wrote:
> Unless I am mistaken, the erlang master/slave modules are designed such that
> all IO (perhaps only file system IO) on the slave is redirected to the
> master. This allows slaves to read/write to the master while doing the heavy
> lifting on the remote cpu.
> I'm not sure if you can access the slave's file system that way.

Network IOs are not redirected, but stdout and file IO seems to be :-)

Do you know a solution to have the same function as slave:start,
without redirection ?
- start a remote node using rsh
- stop remote nodes when killing master

Actually, I do that with os:cmd("ssh remote erl ..."), but it's not
very clean. And the remote erlang vm is not killed when I kill the
master.

Regards,

Bertrand

Nicholas Frechette

unread,
Jul 7, 2010, 9:59:12 AM7/7/10
to Bertrand Paquet, Max Lapshin, erlang-q...@erlang.org
Couldn't you connect the slave to the master and link against say, the
supervisor process of the master? If the node goes down or shuts down, won't
that take down the slave as well?
You could even do all that from the master node via rpc module (ie: fork
slave node with name 'foo', use rpc to fork a process that links both the
process on the master that simply kills the slave node when it receives the
node down message).
You can even send the code from the master such that it doesn't need to be
where the slave is started.
Unless there is a cleaner way to do it, that's probably how I would hack it
up if I had to.
Reply all
Reply to author
Forward
0 new messages