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

时间:2022-05-01 23:37:32

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.

我希望为几个Web服务器,服务器应用程序甚至内部桌面工具中存在的设置设置一个中心控制点。

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.

我还希望这个*数据库能够密切关注访问每个设置的人/访问者。例如,假设我有一个“ProcessedImageUploadFolder”设置,其值为“\\ ImageServer \ cache \”,由5个不同的网站使用,但我想更改此设置,但是查看我的*系统,我看到了我想到的第6个服务器也一直在请求这个设置(调用应用程序需要识别自己以获取设置,因此数据库可以记录它),以防万一改变第6个服务器的此设置将具有副作用。

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.

优选地,解决方案将在C#/ SQL中,但如果唯一的选择是像PHP或Java,我可能会使用它作为基础并移植它。

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.

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

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

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

2 个解决方案

#1


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.

如果Java是一个选项,你可以看一下Commons Configuration。您还可以查看Oracle Applications(第2-21页)中的“配置文件选项”以获取一些想法。配置文件选项具有一个有趣的配置层次结构,其中可以在站点,应用程序,职责和用户级别设置首选项,其中*别首选项优先。

#2


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.

我认为描述你的问题Neil的最佳术语叫做“多租户”。 Devlicious在这里发布了一篇关于多租户的有趣文章: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.

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

Does anyone else have any suggestions?

有没有人有任何建议?

#1


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.

如果Java是一个选项,你可以看一下Commons Configuration。您还可以查看Oracle Applications(第2-21页)中的“配置文件选项”以获取一些想法。配置文件选项具有一个有趣的配置层次结构,其中可以在站点,应用程序,职责和用户级别设置首选项,其中*别首选项优先。

#2


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.

我认为描述你的问题Neil的最佳术语叫做“多租户”。 Devlicious在这里发布了一篇关于多租户的有趣文章: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.

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

Does anyone else have any suggestions?

有没有人有任何建议?