Reputation: 13481
Is there a solution for managing a cluster of dynamically-provisioned servers via JMX?
JMX seems to work fine when working with a known set of servers - type in the hostname to connect to, connect, change settings and look at metrics, and everyone's happy.
What happens when you've got a whole cluster of application instances, and you want to change one setting on all instances in that cluster? Is there any solution that will allow you to change all instances at once, perhaps via some kind of service registry?
Upvotes: 3
Views: 789
Reputation: 16056
Take a look at the OpenDMK. This is the open sourced version of the Java Dynamic Management Kit. It provides JMX with a Discovery Service. To quote from the docs:
The discovery service enables you to discover Java dynamic management agents in a network. This service relies on a discovery client object that sends out multicast requests to find agents. In order to be discovered, an agent must have a registered discovery responder in its MBean server. Applications can also use a discovery monitor that detects when discovery responders are started or stopped.
As for effecting changes on all servers at once, if you implement the discovery service (or something like it), you would be able to quickly compile a list of JMXServiceURLs which in turn could be used to generate a list of JMXConnectors and thereby a list of connected MBeanServerConnections. From there, it should be simple enough to create a multiplexing wrapper around that list that delegates operations against the wrapper out to each remote JMX instance. (Error handling and timeouts might be a little trickier....)
You might even consider coding up a MBeanServerInterceptor which creates a virtual MBeanServer which looks like a MBeanServer but is actually the aforementioned multiplexer in disguise.
//Nicholas
Upvotes: 1