You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Otis Gospodnetic <ot...@gmail.com> on 2014/11/12 23:44:53 UTC

Programmatic Cassandra version detection/extraction

Hi,

Is there a way to detect which version of Cassandra one is running?
Is there an API for that, or a constant with this value, or maybe an MBean
or some other way to get to this info?

Here's the use case:
SPM monitors Cassandra <http://sematext.com/spm/>, but Cassandra MBeans and
metrics have or may change over time.
How will SPM agent know which MBeans to look for, which metrics to extract,
and how to interpret values it extracts without knowing which version
of Cassandra it's monitoring?
It could try probing for some known MBeans and deduce Cassandra version
from that, but that feels a little sloppy.
Ideally, we'd be able to grab the version from some MBean and based on that
extract metrics we know are exposed in that version of Cassandra.

Thanks,
Otis
--
Monitoring * Alerting * Anomaly Detection * Centralized Log Management
Solr & Elasticsearch Support * http://sematext.com/

Re: Programmatic Cassandra version detection/extraction

Posted by Alex Popescu <al...@datastax.com>.
On Wed, Nov 12, 2014 at 2:44 PM, Otis Gospodnetic <
otis.gospodnetic@gmail.com> wrote:

> Hi,
>
> Is there a way to detect which version of Cassandra one is running?
> Is there an API for that, or a constant with this value, or maybe an MBean
> or some other way to get to this info?
>
> Here's the use case:
> SPM monitors Cassandra <http://sematext.com/spm/>, but Cassandra MBeans
> and metrics have or may change over time.
> How will SPM agent know which MBeans to look for, which metrics to
> extract, and how to interpret values it extracts without knowing which
> version of Cassandra it's monitoring?
> It could try probing for some known MBeans and deduce Cassandra version
> from that, but that feels a little sloppy.
> Ideally, we'd be able to grab the version from some MBean and based on
> that extract metrics we know are exposed in that version of Cassandra.
>
> Thanks,
> Otis
>

If you are using the Java driver, you can retrieve the version of Cassandra
for each Host:

http://www.datastax.com/drivers/java/2.1/com/datastax/driver/core/Host.html#getCassandraVersion()


> --
> Monitoring * Alerting * Anomaly Detection * Centralized Log Management
> Solr & Elasticsearch Support * http://sematext.com/
>
>


-- 

[:>-a)

Alex Popescu
Sen. Product Manager @ DataStax
@al3xandru

Re: Programmatic Cassandra version detection/extraction

Posted by Tim Dunphy <bl...@gmail.com>.
This is interesting. If I do a SELECT release_version from system.local; on
my system it's telling me that I'm using 2.1.1

[root@beta-new:/usr/local/apache-cassandra-2.1.2] #cqlsh
Connected to Jokefire Cluster at beta-new.jokefire.com:9042.
[cqlsh 5.0.1 | Cassandra 2.1.1 | CQL spec 3.2.0 | Native protocol v3]
Use HELP for help.
cqlsh> SELECT release_version from system.local;

 release_version
-----------------
           2.1.1

(1 rows)
cqlsh>

[root@beta-new:/usr/local/apache-cassandra-2.1.2] #nodetool gossipinfo  |
grep RELEASE_VERSION
  RELEASE_VERSION:2.1.1

But I definitely launched cassandra from a cassandra-2.1.2 directory.

Could this be because I rsync'd the data directory from a cassandra 2.1.1
directory over to the 2.1.2 directory??

Thanks
Tim

On Thu, Nov 13, 2014 at 10:55 AM, Chris Lohfink <cl...@gmail.com>
wrote:

> There is a "ReleaseVersion" attribute in the
> org.apache.cassandra.db:StorageService bean
>
> ---
> Chris Lohfink
>
> On Wed, Nov 12, 2014 at 5:57 PM, Michael Shuler <mi...@pbandjelly.org>
> wrote:
>
>> On 11/12/2014 04:58 PM, Michael Shuler wrote:
>>
>>> On 11/12/2014 04:44 PM, Otis Gospodnetic wrote:
>>>
>>>> Is there a way to detect which version of Cassandra one is running?
>>>> Is there an API for that, or a constant with this value, or maybe an
>>>> MBean or some other way to get to this info?
>>>>
>>>
>>> I'm not sure if there are other methods, but this should always work:
>>>
>>>    SELECT release_version from system.local;
>>>
>>
>> I asked the devs about where I might find the version in jmx and got the
>> hint that I could cheat and look at `nodetool gossipinfo`.
>>
>> It looks like RELEASE_VERSION is reported as a field in
>> org.apache.cassandra.net FailureDetector AllEndpointStates.
>>
>> --
>> Michael
>>
>
>


-- 
GPG me!!

gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B

Re: Programmatic Cassandra version detection/extraction

Posted by Chris Lohfink <cl...@gmail.com>.
There is a "ReleaseVersion" attribute in the
org.apache.cassandra.db:StorageService bean

---
Chris Lohfink

On Wed, Nov 12, 2014 at 5:57 PM, Michael Shuler <mi...@pbandjelly.org>
wrote:

> On 11/12/2014 04:58 PM, Michael Shuler wrote:
>
>> On 11/12/2014 04:44 PM, Otis Gospodnetic wrote:
>>
>>> Is there a way to detect which version of Cassandra one is running?
>>> Is there an API for that, or a constant with this value, or maybe an
>>> MBean or some other way to get to this info?
>>>
>>
>> I'm not sure if there are other methods, but this should always work:
>>
>>    SELECT release_version from system.local;
>>
>
> I asked the devs about where I might find the version in jmx and got the
> hint that I could cheat and look at `nodetool gossipinfo`.
>
> It looks like RELEASE_VERSION is reported as a field in
> org.apache.cassandra.net FailureDetector AllEndpointStates.
>
> --
> Michael
>

Re: Programmatic Cassandra version detection/extraction

Posted by Michael Shuler <mi...@pbandjelly.org>.
On 11/12/2014 04:58 PM, Michael Shuler wrote:
> On 11/12/2014 04:44 PM, Otis Gospodnetic wrote:
>> Is there a way to detect which version of Cassandra one is running?
>> Is there an API for that, or a constant with this value, or maybe an
>> MBean or some other way to get to this info?
>
> I'm not sure if there are other methods, but this should always work:
>
>    SELECT release_version from system.local;

I asked the devs about where I might find the version in jmx and got the 
hint that I could cheat and look at `nodetool gossipinfo`.

It looks like RELEASE_VERSION is reported as a field in 
org.apache.cassandra.net FailureDetector AllEndpointStates.

-- 
Michael

Re: Programmatic Cassandra version detection/extraction

Posted by Michael Shuler <mi...@pbandjelly.org>.
On 11/12/2014 04:44 PM, Otis Gospodnetic wrote:
> Is there a way to detect which version of Cassandra one is running?
> Is there an API for that, or a constant with this value, or maybe an
> MBean or some other way to get to this info?

I'm not sure if there are other methods, but this should always work:

   SELECT release_version from system.local;

-- 
Michael