Erlang filesystem
Ulf Wiger
etxuwig@REDACTED
Fri May 9 23:54:05 CEST 2003
On Fri, 9 May 2003, Chris Pressey wrote:
>On Thu, 17 Apr 2003 Ulf Wiger <etxuwig@REDACTED> wrote:
>> A common setup is to keep the same code on all nodes -- i.e.
>> identical application trees. One very good reason for doing
>> this is to avoid having different versions of the same
>> module in the system.
>
>This is one of the things that got me thinking about a
>replicated file system.
>
>It would be interesting to know how people handle keeping
>their code in synch across nodes - i.e., what's most
>popular - rpc:multicall(code, load_binary, [Mod, Bin,
>File])? rsync? Manually copying the code over when it
>changes? Using the release handler somehow?
The release handler works well for this. It's designed to
support synchronized upgrade on multiple nodes.
>It IS trivial to read an entire file from another node:
>
> > rpc:call(catbus@REDACTED, file, read_file, [".cshrc"]).
> {ok,<<35,32,36,70,114,101,101,66,83,68,58,32,115,114,99,47,115,
> 104,97,114,101,47,115,107,101,108,47,...>>}
>
>But when I try just opening it:
>
> > {ok,H} = rpc:call(catbus@REDACTED, file, open, [".cshrc",
> [read]]).
> {ok,<3931.59.0>}
> > rpc:call(catbus@REDACTED, file, read, [H, 100]).
> {error,terminated}
> > file:format_error({error,terminated}).
> "unknown POSIX error"
Not sure why you get 'terminated', but a problem with doing
it this way is that the rpc:call/3 will be executed in a
temporary process on catbus; when the call completes, the
process is terminated, and since it is the owner of the file
descriptor, the file will be closed automatically.
I think what you want to do is to run your other nodes as
loader slaves to catbus. It's not incredibly clear from the
documentation (or I haven't found the place in the
documentation where it's clearly described) how to do this.
You may try with erl -loader inet -hosts ...
or reading the code in file_server.erl, one might perhaps
try erl -master catbus@REDACTED, but that doesn't seem
to work for me, and I don't find any documentation on it.
(I'm sorry I can't give you a working example. From a
cursory glance, it's not obvious to me how one tests an
erlang node using another erlang node on the same host as a
boot loader (it seems consistent with the erlang philosophy
that one should be able to do this), and I'm not sure if you
need to use a boot server in order to have a file server.
I'm sure this is explained in the docs somewhere, but it's
late, and I intend to go home and get some sleep.)
/Uffe
--
Ulf Wiger, Senior Specialist,
/ / / Architecture & Design of Carrier-Class Software
/ / / Strategic Product & System Management
/ / / Ericsson AB, Connectivity and Control Nodes
More information about the erlang-questions
mailing list