Erlang分布式银行系统
我试图用 Erlang 来说明分布式应用程序的概念。我的系统目前有一台服务器和一台 ATM。我尽量保持简单。
目前我的应用程序在本地运行。我使用 gen_server
来建立银行服务器和 ATM 之间的客户端-服务器关系。我还有一个 gen_fsm 模块来建议我的 ATM 的不同状态。为了存储任何数据,我使用 dict 模块(我不想使用数据库让事情变得更复杂)。为了保持进程处于活动状态(gen_server
和 gen_fsm
),我使用了 supervisor
进程。我已将所有模块包装为一个应用程序,但目前它都是本地的。任何想法将不胜感激。
我正在考虑在两个不同的节点上启动相同的应用程序,并说明分布式概念以使用某种故障转移/接管机制,但我不知道要使用哪些模块。
- 是否强制使用目标系统?(在某些时候我必须对应用程序进行热升级)
- 执行这些操作的正确顺序是什么:首先升级,然后分发?
如果有人能给我一些关于如何完成所有这些事情的想法,我将非常感激。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我自己从未尝试过,但文档似乎指出:
Erlang 发布处理(11.3 分布式系统)。
这是一个非常短的段落,显示了
sync_nodes
命令,我建议您阅读整章,因为我注意到并发和分布的概念在 Erlang 中通常是如此普遍,以至于像您这样的问题已经得到解决并且包含在 OTP 中。顺便说一句,Erlang 用户指南还有一整章专门介绍似乎相关的分布式应用程序对于分布式应用程序配置选项,我认为两者应该可以解决问题。
希望这对您有所帮助,如果您需要更多帮助,请询问!
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!