对Cassandra连接的健康检查(使用hector)? [英] Health check for Cassandra connection (using hector)?

查看:163
本文介绍了对Cassandra连接的健康检查(使用hector)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的应用程序的操作监视,我正在寻找类似于常用的SQL连接验证查询的内容。

For operations monitoring of my application, I am looking for something similar to the commonly used "SQL connection validation" query


SELECT 1 ;在Cassandra中使用Hector驱动程序

SELECT 1;

我试过像Cluster.getKnownPoolHosts()和.getConnectionManager()。getActivePools()。但是似乎他们的状态不是不断更新,只有当我实际尝试访问Cassandra与查询。

in Cassandra, using the Hector driver. I have tried things like looking at Cluster.getKnownPoolHosts() and .getConnectionManager().getActivePools(). But it seems that their status is not continuously updated, only when I actually try to access Cassandra with a query.

我想我的健康检查独立于任何键空间或用户CF,需要存在,所以只是运行一个虚拟查询似乎很难(反对什么?)。当然,它不应该占用大量的内存或产生任何重要的负载。

I'd like my health check to be independent of any keyspaces or user CFs that need to exist, so just running a "dummy" query seems difficult (against what?). And of course it shouldn't take a lot of memory or generate any significant load.

我可以强迫Hector更新其连接池状态,而不运行一个真正的查询?

Can I force Hector somehow to update its connection pool status without running a real query?

(BTW:CQL甚至不接受SELECT 1作为有效查询。)

(BTW: CQL doesn't even accept "SELECT 1" as a valid query.)

推荐答案

我目前使用的解决方案,似乎是迄今为止最强大的(用Cassandra 1.1和1.2测试)是一个简单的查询系统:

The solution I'm currently using, and which seems to be the most robust so far (tested with Cassandra 1.1 and 1.2) is a simple query on "system":

查询< String> query = Query.selectQuery(*,system,null,1,consistencyLevel,StringSerializer.get());

不是我想要的,因为它是一个真正的查询,但在另一方面,它不给任何假阳性。

It's not exactly what I wanted since it's a "real" query, but on the other hand it doesn't give any false positives.

这篇关于对Cassandra连接的健康检查(使用hector)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆