Erlang:如何重新加载应用程序环境配置?
如何重新加载应用程序的配置?或者,管理动态应用程序配置的好策略是什么?
例如,假设我有日志级别,并且我想在运行时更改它们。另外,我们假设这是许多此类选项之一。拥有一个保存配置状态以供应用程序其他部分查询的“配置服务器”是否有意义?是人们这么做的还是我编造的?
How do you reload an application's configuration? Or, what are good strategies for managing dynamic application configuration?
For example, let's say I had log levels and I wanted to change them at runtime. Also, let's assume this is one of many such options. Does it make sense to have a "configuration server" that holds configuration state for other parts of the application to query? Do people do that or did I just make it up?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为将所有配置数据保存在存储库(subversion、mercurial 等)中并让应用程序在每次启动或尝试重新加载
一些其配置选项时下载它是合理的。这是集中式方法 - 但是您可以拥有许多配置服务器来避免SPOF - 并且它:知道是谁放的以及他何时放的
那个(没有人愿意负责
配置不正确);
您身边的所有应用程序
网络;
配置并通知相关应用程序
使用 gen_server:abcast 调用或其他方式。
proplists(3)
在读取配置时很有用。I believe it's reasonable to keep all your configuration data in a repository (subversion, mercurial etc.) and have applications download it every time they start or attempt to reload
sometheir configuration options. This is centralized approach — however you could have many configuration servers to avoid SPOF — and it:know who put these and when (s)he did
that (none wants to be in charge of
unproper configuration);
all applications throughout you
network;
configuration and notify concerned applications
using
gen_server:abcast
call or other means.proplists(3)
are useful when reading configuration.如果我的理解是正确的,那么问题如下:
你想要创建一个分布式、可扩展的系统,当然Erlang是你想到的第一选择,因为它就是为此目的而设计的。
这里最简单的层次结构是为每个主要功能提供热备用备份。
这可以通过实现分布式应用程序控制器来实现。
最简单的示例是在节点上启动服务器,同时在配合节点上启动从属服务器。
分布式应用程序控制器有很多优点。
如果我误解了什么,请详细说明或评论。
祝你好运!
If my understanding is correct, the problem is the following:
You want to create a distributed, scalable system and of course Erlang is the first choice that comes into mind, since it was designed for such purposes.
You will have several nodes that will be running local applications and also distributed applications as well.
Here the simplest hierarchy is to have a hot-standby backup for every major functionality.
This can be achieved by implementing a distributed application controller.
Simplest example is to have a server start on a node, while a slave server is started simultaneously on a mate node.
Distributed Application controllers have many advantages.
Please elaborate or comment if I misunderstood something.
Good luck!