Health check for Cassandra connection (using hector)?

[亡魂溺海] 提交于 2019-12-03 11:21:03

With CQL3, I'm using the following query:

SELECT now() FROM system.local;

It would be nice to get rid of the FROM clause altogther to make this generic, in case the user does not have access to the system keyspace or local column family for some reason. But as with the other answers, at least this should not give false positives.

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":

Query<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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!