简体   繁体   English

如何在Cassandra Server上跟踪查询?

[英]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 . 我已经厌倦了为Cassandra和日志记录活动中提到的org.apache.cassandra.thrift.CassandraServer添加启用DEBUG日志记录 But that does not provide much info (eg says slice query executed, but does not give more info). 但这并没有提供太多信息(例如,执行切片查询,但没有提供更多信息)。

Is there a better way? 有没有更好的办法?

Cassandra 1.2 introduced a new request tracing capability that will allow you to track the progression of reads and writes throughout Cassandra. Cassandra 1.2 引入了一种新的请求跟踪功能 ,可以跟踪整个Cassandra的读写过程。

To view traces, fire up cqlsh on one of your Cassandra nodes and run the following command: 要查看跟踪,请在其中一个Cassandra节点上启动cqlsh并运行以下命令:

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. 我相信只要打开该节点的跟踪,你就会继续在CQL shell中看到跟踪。

Alternatively, according to this follow-up blog post about advanced Cassandra request tracing from DataStax 或者,根据这篇后续博客文章,关于DataStax的高级Cassandra请求跟踪

You can configure probabilistic tracing. 您可以配置概率跟踪。

nodetool settraceprobability or via JMX nodetool settraceprobability或通过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. 此跟踪信息将保留在system_traces键空间中最多24小时(您可以更改此表上的TTL),因此您可以稍后根据需要查询它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM