[erlang-questions] distributed system: same app, different params
Mon Jun 22 17:33:29 CEST 2009
On 18/giu/09, at 09:10, Ulf Wiger wrote:
> Roberto Ostinelli wrote:
>> what i do now is:
>> 1. i have an escript file which:
>> - reads the parameters from a configuration file
>> - starts the 2 erlang nodes, using os:cmd/1 and passing the
>> configuration parameters, with a command like
>> run_erl -daemon $PIPE_DIR/$node_id $LOGS_DIR "exec erl -name
>> $node_id -run go start -params $params"
>> 2. in the module go, the function start/1:
>> - reads the passed parameters;
>> - starts the application my_app, passing the appropriate values.
>> 3. the escript file is started as daemon on the target machine.
>> though this does work, it seems way too non-erlangish to me.
> No, this is pretty much how it's done.
> You could go even more non-erlangish and use normal environment
> variables (which you can read from within Erlang using os:getenv(Var),
> but the way you're doing it has the distinct advantage that it works
> well even if the two nodes execute on the same machine.
> What many applications (e.g. mnesia) use are OTP application
> variables. You Erlang application can access them using
> application:get_env(Var) % the current application
> application:get_env(App, Var) % a specific application
> An example of this would be erl ... -mnesia dir Path
> Ulf W
> Ulf Wiger
> CTO, Erlang Training & Consulting Ltd
hi, can i ask for a little clarification more: what would you use to
deploy this script on many different machines? mechanisms such as bash
script managers over the network, application_controller, ...?
More information about the erlang-questions