Database Reference
In-Depth Information
Chapter9.Monitoring
This chapter is about using a variety of tools to monitor and understand important events in the
life cycle of your Cassandra cluster. We'll look at some simple ways to see what's going on, such
as changing the logging levels and understanding the output.
But Cassandra also features built-in support for Java Management Extensions (JMX), which of-
fers a rich way to monitor your Cassandra nodes and their underlying Java environment. With
just a little integration work, we can see the health of the database and ongoing events, and even
interact with it remotely to tune certain values. JMX is an important part of Cassandra, and we'll
spend some time to make sure we know how it works and what exactly Cassandra makes avail-
able for monitoring and management with JMX, and we'll even write our own custom MBean
to expose a new Cassandra feature. Let's get started!
Logging
The simplest way to get a picture of what's happening in your database is to just change the log-
ging level to make the output more verbose. This is great for development and for learning what
Cassandra is doing under the hood.
Cassandra uses Log4J for its logging utility. By default, the Cassandra server log level is set at
INFO , which doesn't give you much detail about what work Cassandra is doing at any given time.
It just outputs basic status updates, such as the following:
INFO 08:49:17,614 Saved Token found: 94408749511599155261361719888434486550
INFO 08:49:17,614 Saved ClusterName found: Test Cluster
INFO 08:49:17,620 Starting up server gossip
INFO 08:49:17,655 Binding thrift service to morpheus/192.168.1.5:9160
INFO 08:49:17,659 Cassandra starting up...
When you start Cassandra in a terminal, you keep this output running in the terminal window
by passing the program the -f flag (to keep output visible in the foreground of the terminal win-
dow). But Cassandra is also writing these logs to physical files for you to examine later.
By changing the logging level to DEBUG , we can see much more clearly what activity the server
is working on, instead of seeing only these stage updates.
To change the logging level, open the file <cassandra-home>/conf/log4j-server.propertiesand
find the line that looks like this:
log4j.rootLogger=INFO,stdout,R
Change this line so it looks like this:
Search WWH ::




Custom Search