通过 MOM 在 WAS 集群内传播配置
我正在开发嵌入在Websphere AS 集群环境中的应用程序。我正在使用多个节点,有时我想动态更改配置设置并将其传播到集群中的所有节点。我不想将配置保存在数据库中,或者至少我想将其缓存在节点级别并触发配置刷新操作,这会强制每个节点从某些共同点(即数据库或网络驱动器)刷新配置 以避免不断往返配置存储。
此外,某些配置无法存储在数据库中,即日志级别需要分别应用于每个节点中的记录器对象。
我正在考虑使用 JMS 主题和发布/订阅方法来实现该目标。 这个想法是每个节点都可以订阅每个主题,并且无论哪个节点启动配置更改修改都会传播到集群内的所有节点。
有没有人尝试过在 WAS 中这样做,这种方法是否有任何障碍。如果有或者您对如何解决该问题有任何其他建议,我将非常感谢您的帮助。
提前发送, 马尔辛
I am developing application which is embedded within the cluster environment in Websphere AS. I am using several nodes and sometimes I would like to change configuration settings on the fly and propagate it to all nodes within the cluster. I don't want to hold the config in the db or at least I would like to cache it on the node level and trigger config refresh action which forces each node to refresh the config from some common ground (i.e. db or net drive)
to avoid constant round-trips to the config storage.
More over some configuration can't be stored in db i.e. log level needs to be applied on the logger object in each node separately.
I was thinking about using JMS Topics and publish/subscribe approach to achive that goal.
The idea is that each node could subscribe to each Topic and no matter which nodes initate the config change modification would be propagated to all nodes within the cluster.
Has anyone ever tried to do that in WAS and whether there are any obstacles with this approach. If there are or if you have any other suggestion on how to solve that problem I would be very greatfull for your help.
Tx in advance,
Marcin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下是一些可以考虑作为 JMS 替代方案的选项 -
使用 Java EE 环境条目。这些范围仅限于应用程序,WAS 会自动将任何更改传播到部署该应用程序的所有服务器。这是一个很好的方法,因为它是应用程序配置的标准 Java EE 方法(如果它足够强大来满足您的用例)。
使用 WebSphere 共享库。这允许您将应用程序链接到应用程序外部(即文件系统上)的静态文件,以便它们在您的类路径上可用。尽管这些文件位于节点文件系统上,但有一种方法可以将这些文件放置在 WebSphere 的集中配置存储库中,以便它们自动传播到所有 WAS 节点。有关此内容的更多详细信息,请参阅 这个答案。
这两个选项都针对静态配置进行了优化;换句话说,配置设置旨在在组装时、部署时设置或由系统管理员更改,但它们通常不用于频繁更改的值,也通常不会在运行时以编程方式更改。 WAS 确实允许您的应用程序以滚动方式选择这些配置设置,因此不需要应用程序停机。
Here are a few options to consider as alternatives to JMS -
Use Java EE environment entries. These are scoped to the application, and WAS will automatically propagate any changes to all servers against which the application is deployed. This is a good approach since it is the standard Java EE approach to application configuration, if it is robust enough to meet your use case.
Use a WebSphere Shared Library. This allows you to link your applications to static files external to your application (i.e. on the filesystem), such that they are available on your classpath. Although these files are located on the node file systems, there is a way that you can place these files in WebSphere's centralized configuration repository such that they are automatically propagated to all WAS nodes. For more details on this, see this answer.
Both of these options are optimized for static configuration; in other words, configuration settings that are intended to be set at assembly-time, deployment-time, or to be changed by system administrators, but they are not typically used for values that change frequently, nor are they generally changed programmatically at runtime. WAS does allow your applications to pick these configuration settings in a rolling fashion, such that no application downtime is required though.
目前,我们解决这个问题的方法可能不是最漂亮的,而是最简单的。由于我们仅使用 2 个节点,因此我们可以进入特定节点的 Web 界面,在其中修改每个节点的设置。也许它不是很漂亮,但目前这是最简单的方法。配置存储在数据库中,我们计划在每个节点中触发配置重新加载,并更改每个节点的日志级别。
Currently we solved the problem with maybe not the most pretty approach but with the most simple one. Since we are using only 2 nodes we have possibility to enter web interface of specific node where we modify settings per each node. Maybe it is not very pretty but for now it is the easiest way. The config is stored in DB and we are planning to trigger config reload in each node and change the log level per node as well.