1
votes

I am trying to ilustrate the concept of distributed applications using Erlang. My system currently has one server and one ATM. I try to keep it as simple as possible.

For the moment my application runs locally. I am using gen_server for a client-server relationship between the banking server and the ATM. I also have a gen_fsm module to suggest different states my ATM has. In order to store any data i use the dict module (I don't want to make things more complicated using databases). To keep processes alive (the gen_server and gen_fsm) I am using a supervisor process. I've wrapped all modules as an application but for the moment it's all local. Any ideas would be highly appreciated.

I was thinking to start the same application on two different nodes and to illustrate the distributed concept to use some kind of failover/takeover mechanism but I have no ideas on what modules to use.

  • Is it mandatory to use target systems?(at some point i must do a hot upgrade to the application)
  • What's the correct order to do these things: first to upgrade and then distribute?

I would be very grateful if someone could give me some ideas on how to accomplish all those things.

1
Are you asking what you should focus on first, hot upgrade or distribution? Nothing is really mandatory :-) but using target systems and OTP will help you a lot when doing distributed systems and hot code upgrade.Adam Lindberg
I must do both things. My application is already structured according to OTP rules but my behaviour processes (server,fsm,supervisor) are all local. I guess using releases will do the job for the hot upgrade. Regarding the distribution, i haven't found any proper example on how to create and where to place the config files for each node. Some guidelines and maybe the order on how to achieve both things will help me very much. Thank you for your promptitude Adam.ar3tzu

1 Answers

1
votes

I never tried it myself, but docs seem to point to: Erlang Release Handling (11.3 Distributed Systems).

It's a really short paragraph showing the sync_nodes command, I suggest you to read the whole chapter because I noticed that often the concepts of concurrency and distribution are so persavive in Erlang that problems like yours have already been solved and included in OTP.

BTW, Erlang user guide also has a whole chapter dedicated to Distributed Applications that seems related to distributed applications config options, I think that the two should do the trick.

Hope this helps, if you need more help just ask!