Database Reference
In-Depth Information
public Set<InetAddress> getStreamSources();
public List<String> getIncomingFiles(String host) throws IOException;
public String getStatus();
}
There are two basic ideas here: a stream source and a stream destination. Each node can stream
its data to another node in order to perform load balancing, and this class supports these op-
erations. The MBean methods give you a necessary view into the data that is moving between
nodes in the cluster.
The getStatus operation is not an enumeration with some set list of possible statuses. It rather
returns a string in the form of ReceivingFrom: [node] SendingTo: [node] .
So in conjunction with the Storage-Service MBean, if you're concerned that a node is not
receiving data as it should, or that a node is unbalanced or even down, these two services work-
ing together can give you very rich insight into exactly what's happening in your cluster during a
snapshot in time.
Custom Cassandra MBeans
Let's quickly write a very simple MBean so that you can do this kind of work yourself if there's
a new feature you'd like to JMX-enable. There's nothing to it.
First, we get the source code and create our MBean interface next to the Cassandra source file it
wraps. Our MBean will return the current version of the Cassandra API, which is not currently
available in Cassandra. Our MBean looks like this:
package org.apache.cassandra.thrift;
public interface CassandraServerMBean {
public String getVersion();
}
Now we need to open up the source of CassandraServer.javaand make it implement our MBean
interface and hook into the JMX server. Finally, we'll actually implement the method. Thrift
generates a version number that is accessible from the CLI, so we'll just reuse that. Our new
CassandraServer.javaclass looks like this:
package org.apache.cassandra.thrift;
import javax.management.MBeanServer;
import javax.management.ObjectName;
Search WWH ::




Custom Search