Database Reference
In-Depth Information
Some MBeans return an attribute value of
javax.management.openmbean.CompositeDataSupport . That means that these are not
simple values that can be displayed in a single field, such as LoadedClassCount , but are instead
multivalued. One example is Memory > HeapMemoryUsage , which offers several data points and
therefore has its own view.
Another type of MBean operation is one that doesn't simply show a value or allow you to set
a value, but instead lets you execute some useful action. dumpAllThreads and resetPeak-
ThreadCount are two such operations.
Now we'll quickly get set up to start monitoring and managing Cassandra specifically.
Integrating JMX
Enabling Cassandra to use JMX is easy, but there are a couple of dependencies. Go to ht-
tp://mx4j.sourceforge.net and download version 3.0.1 of the library MX4J. You can probably
use a newer version if one's available, but this version is known to work.
After you've downloaded the library, unzip it and navigate to the libdirectory. Copy two JARs
from this directory: mx4j.jarand mx4j-tools.jar. Paste them into your <cassandra-home>/libdir-
ectory and restart Cassandra. Now other Cassandra nodes can connect via JMX to monitor its
health and even to set values for the functions that are exposed as MBeans.
If you've downloaded Cassandra's source code, just drop the two necessary JARs into the libdir-
ectory and rebuild the source. The next time you start Cassandra, you should see output similar
to the following:
INFO 13:37:28,473 Cassandra starting up...
DEBUG 13:37:28,474 Will try to load mx4j now, if it's in the classpath
INFO 13:37:28,508 mx4j successfuly loaded
HttpAdaptor version 3.0.2 started on port 8081
Here, MX4J will act as our JMX server agent, and now we're ready to start getting some benefit
from JMX.
Interacting with Cassandra via JMX
Now that JMX is enabled, let's connect to Cassandra on its JMX port. To do so, open a new
terminal and type the following:
>jconsole
When you run jconsole , you'll see a login screen similar to that in Figure 9-4 .
Search WWH ::




Custom Search