JMX for cloud applications
Is there a solution to manage a cluster of dynamically created servers via JMX?
JMX works fine with a known set of servers - enter the hostname to connect, connect, change settings, and view metrics and everyone is happy.
What happens when you have a whole set of application instances and you want to change one setting across all instances of that cluster? Is there any solution that will allow you to change all instances at once, perhaps through some kind of service registry?
source to share
The Discovery Service allows you to discover dynamic management of Java agents on the network. This service is based on a discovery client entity that sends multicast requests to locate 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, which detects that when the discovery starts or stops, it is responsive.
As far as making changes to all servers at once, if you implement a discovery service (or something like that), you can quickly compose a JMXServiceURL list , which in turn can be used to create a JMXConnector list and thus a list of connected MBeanServerConnection s. From there, it should be easy enough to create a multiplexing wrapper around this list that delegates operations against the wrapper to each remote JMX instance. (Error handling and timeouts can be a little tricky ....)
You might even consider encoding the MBeanServerInterceptor , which creates a virtual MBeanServer that looks like an MBeanServer, but is actually the aforementioned multiplexer. / p>
source to share