在多个服务器/应用程序之间共享全局变量

发布于 2024-07-23 11:06:14 字数 736 浏览 2 评论 0原文

我希望为多个 Web 服务器、服务器应用程序甚至可能是内部桌面工具中存在的设置建立一个中心控制点。

目前的情况是,我在每个网络服务器上或每个应用程序内都有一个设置文件,定义了全局变量:管理电子邮件、存储上传文件的位置等。一些设置(例如用于发送错误报告的全局管理电子邮件)是几乎全公司范围内。 其他设置可能是特定于客户端或站点的。

我还希望这个中央数据库能够密切关注谁/什么正在访问每个设置。 例如,假设我有一个“ProcessedImageUploadFolder”设置,其值为“\\ImageServer\cache\”,由 5 个不同的网站使用,但我想更改此设置,但查看我的中央系统,我发现有一个我没有想到的第六台服务器也一直在请求此设置(调用应用程序需要识别自己才能获取设置,以便数据库可以记录它),以防万一更改第六台服务器的此设置会产生副作用。

在使用我自己的数据库提供并记录设置的服务之前,我想知道是否有任何库/应用程序已经可以处理类似的事情。 如果已经做了这样的事情,有人有什么想法吗? 这种类型的系统叫什么?

最好的解决方案是 C#/SQL,但如果唯一的选择是 php 或 Java,我可能会使用它作为基础并移植它。

或者我对这一切都错了?

编辑: 这不是多租户。 一些使用此服务的应用程序已经处于多租户设置中。 其他是一次性应用程序...其他是在本地网络或 VPN 上使用的桌面应用程序。

如果有人可以更好地标记这个问题,请成为我的客人。

I am looking to set up a central point of control for settings that exist across several web servers, server applications, and possibly even internal desktop tools.

The current situation is that I have a settings file on each webserver or within each application, with Global Variables defined: Admin Email, Where to store uploaded files, etc. Some settings (such as a global admin email to send error reports to) are pretty much Company wide. Other settings may be client or site specific.

I also want this this central DB to be able to keep tabs on who/what is accessing each setting. For example say I have a "ProcessedImageUploadFolder" setting, with a value of "\\ImageServer\cache\" that is used by 5 differnt web sites, but I want to change this setting, but looking at my central system, I see that theres a 6th server that I didnt think of that has also been requesting this setting (the calling app needs to identify itself to get a setting, so the DB can log it), just in case changing this setting for the 6th server would have an side effects.

Before rolling my own DB with a service to dish out and log the settings, I'm wondering if there are any libraries/apps that handle something like this already. Does anyone have any ideas if something like this has been done? What is this type of system called?

Perferably the solution would be in C#/SQL but if the only option was something like php or Java, I would probably use that as a base and port it.

Or am I going about this all wrong?

EDIT:
This is not mult-tenancy. Some of the apps that would use this service are already in a multi-tenant set up. Others are one-off apps... others are desktop apps used on the local network or the VPN.

If anyone can tag this question better, be my guest.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

嗫嚅 2024-07-30 11:06:15

带有服务的中央数据库似乎是一条出路。 确保您的应用程序缓存配置,以便它们不会在每次请求时都访问数据库,并且即使中央数据库暂时不可用,它们也能够继续运行。

如果可以选择 Java,您可以查看 Commons Configuration。 您还可以查看 Oracle 应用程序(第 2-21 页)了解一些想法。 配置文件选项有一个有趣的配置层次结构,其中可以在站点、应用程序、职责和用户级别设置首选项,其中最高级别的首选项优先。

A central database with a service seems like the way to go. Make sure that your applications cache the configuration, so that they won't hit the database on every request, and also so that they will be able to keep going if the central database is temporarily unavailable.

If Java is an option, you could take a look at Commons Configuration. You could also have a look at Profile Options in Oracle Applications (page 2-21) for some ideas. Profile Options have an interesting configuration hierarchy, where preferences may be set at the site, application, responsibility, and user level, with the highest level preference taking precedence.

迷途知返 2024-07-30 11:06:15

我认为描述尼尔的问题的最佳术语是“多租户”。 Devlicious 在此处发布了一篇关于多租户的有趣文章:http://devlicio.us/blogs/anne_epstein/archive/2009/04/24/the-case-for-multiple-dbs-in-multi-tenancy-situations。 .aspx.

如果我正在编写 sshared 配置服务,我会尝试使用类似于服务定位器模式 的模式来实现http://martinfowler.com/articles/injection.html#UsingAServiceLocator 并开发一个易于扩展且易于互操作的 Web 服务。 无论是 1 个数据库、2 个数据库还是多个 xml 配置文件,该服务都会抽象您的设计。

还有其他人有什么建议吗?

I think the best term to describe your question Neil would is called "Multi Tenancy". Devlicious posted an interesting article on Multi Tenancy here: http://devlicio.us/blogs/anne_epstein/archive/2009/04/24/the-case-for-multiple-dbs-in-multi-tenancy-situations.aspx.

If I was coding a sshared configuration service I would try to implement using a pattern similar to the Service Locator Pattern http://martinfowler.com/articles/injection.html#UsingAServiceLocator and develop a web service that is easily extendible and easy to interop with. The service would abstract your design regardless of whether it is 1 database, 2 databases or multiple xml configuration files.

Does anyone else have any suggestions?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文