Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I trace Queries at Cassandra Server?

I am talking to Cassandra using Hector. Is there a way that I can trace the executed queries at the server?

I have tired adding Enable DEBUG logging for org.apache.cassandra.thrift.CassandraServer as mentioned in Cassandra vs logging activity. But that does not provide much info (e.g. says slice query executed, but does not give more info).

Is there a better way?

like image 586
srinath_perera Avatar asked Nov 10 '13 17:11

srinath_perera


1 Answers

Cassandra 1.2 introduced a new request tracing capability that will allow you to track the progression of reads and writes throughout Cassandra.

To view traces, fire up cqlsh on one of your Cassandra nodes and run the following command:

cqlsh> tracing on;
Now tracing requests.
cqlsh> use [KEYSPACE];

And I believe for as long as tracing for that node is turned on you'll continue to see traces in the CQL shell.

Alternatively, according to this follow-up blog post about advanced Cassandra request tracing from DataStax

You can configure probabilistic tracing.

nodetool settraceprobability or via JMX

This tracing information will be retained in the system_traces keyspace for up to 24 hours (you can change the TTL on this table), so you can query it from there later if you wish.

like image 177
Aaronontheweb Avatar answered Nov 10 '22 06:11

Aaronontheweb