• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

manage config files in a cluster

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have to manage a cluster of tomcats or other appservers by JMX to implement the synchronization of config files. Each Tomcat node has a config file for the deployed application with a management web UI. When we update the config file on one node thru the management UI, we want all the config files on the cluster updated.
Can notifications do this?
Any idea would be appreciate.
 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This might get moved to the Tomcat forum, but its really a general pattern EJB question.

One solution. Set up a singleton on each node that reads the files when the server starts. All reading of the files by all applications modules is done through this singleton. Finally, you want the singleton to periodically check the file for changes using some kind of timeout value so that it does not check to often. If the config file changes, notify the listeners (you can use the java.util.Observable structure for this).

There are many other solutions including always reading the latest version, JNDI stored objects, database objects, and more, but I like the singleton for performance and control of config files.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Our cluster loads volatile configuration from a database. We broadcast a "refresh" message that tells all servers in the cluster to clear cached configuration. This felt safer to me than sending updates to the cluster. If a server is down and misses the refresh message, it will still get the right stuff from the database when it comes back up.

There is some 3rd party code (I can blame somebody else) that broadasts changes over JMS as you suggest. I thought it was interesting that the server that makes the value change doesn't really make the value change. It publishes the "change tag x to value y" message and receives it from pub-sub just like every other node in the cluster. I suppose that's standard pub-sub.
 
L Deng
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you guys to give different answer to solve the problem. But our design must be restricted to JMX structure. Since there's no JMX forum here, would you please move this to Tomcat forum, Moderator? Thank you!

Now my problem seems to be, is that possible for an application to invoke MBean methods of application deployed in a different Tomcat instance? I have refered to http://tomcat.apache.org/tomcat-5.5-doc/monitoring.html and it says "MX4J JSR 160 RMI Adaptor to support JDK 1.4 currently not integrated." What is that mean? Do that mean MX4J JSR 160 RMI Adaptor can't work with Tomcat? And what is "Manage Tomcat with JMX remote Ant Tasks"? Can that be helpful?

Thank you in advance.
 
He got surgery to replace his foot with a pig. He said it was because of this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic