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

Programmatic HBase version detection/extraction

Hi,

Is there a way to detect which version of HBase 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?

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

Re: Programmatic HBase version detection/extraction

Posted by Ted Yu <yu...@gmail.com>.
Java-wise, you can use this API in HBaseAdmin:

  ClusterStatus getClusterStatus() throws IOException;

ClusterStatus provides:

  public String getHBaseVersion() {

Cheers

On Wed, Nov 12, 2014 at 2:06 PM, Ted Yu <yu...@gmail.com> wrote:

> Otis:
> You can parse the output from "status 'detailed'" command - look for the
> line starting with 'version'
>
> I checked the output from /jmx but didn't find such information there. The
> version would appear in the classpath but that's not easy to parse.
>
> One note about "hbase version" is that it returns the version of HBase
> client was built with - not the version of the cluster the client is
> talking to.
>
> Cheers
>
> On Wed, Nov 12, 2014 at 1:49 PM, Otis Gospodnetic <
> otis.gospodnetic@gmail.com> wrote:
>
>> Hi Ted,
>>
>> Thanks, but I'm looking for something I can grab programmatically (not
>> manually), for example from a Java app.  Maybe there is some API that
>> exposes this information or an MBean?
>>
>> Here's the use case:
>> SPM monitors HBase <http://sematext.com/spm/>, but HBase MBeans and
>> metrics
>> have changed 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
>> HBase it's monitoring?
>> It could try proming for some known MBeans and deduce HBase 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 HBase.
>>
>> Thanks,
>> Otis
>> --
>> Monitoring * Alerting * Anomaly Detection * Centralized Log Management
>> Solr & Elasticsearch Support * http://sematext.com/
>>
>>
>> On Wed, Nov 12, 2014 at 4:41 PM, Ted Yu <yu...@gmail.com> wrote:
>>
>> > Using hbase shell:
>> >
>> > hbase(main):002:0> status 'detailed'
>> > version 0.98.4.2-hadoop2
>> >
>> > Cheers
>> >
>> > On Wed, Nov 12, 2014 at 1:37 PM, Otis Gospodnetic <
>> > otis.gospodnetic@gmail.com> wrote:
>> >
>> > > Hi,
>> > >
>> > > Is there a way to detect which version of HBase 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?
>> > >
>> > > Thanks,
>> > > Otis
>> > > --
>> > > Monitoring * Alerting * Anomaly Detection * Centralized Log Management
>> > > Solr & Elasticsearch Support * http://sematext.com/
>> > >
>> >
>>
>
>

Re: Programmatic HBase version detection/extraction

Posted by Ted Yu <yu...@gmail.com>.
Otis:
You can parse the output from "status 'detailed'" command - look for the
line starting with 'version'

I checked the output from /jmx but didn't find such information there. The
version would appear in the classpath but that's not easy to parse.

One note about "hbase version" is that it returns the version of HBase
client was built with - not the version of the cluster the client is
talking to.

Cheers

On Wed, Nov 12, 2014 at 1:49 PM, Otis Gospodnetic <
otis.gospodnetic@gmail.com> wrote:

> Hi Ted,
>
> Thanks, but I'm looking for something I can grab programmatically (not
> manually), for example from a Java app.  Maybe there is some API that
> exposes this information or an MBean?
>
> Here's the use case:
> SPM monitors HBase <http://sematext.com/spm/>, but HBase MBeans and
> metrics
> have changed 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
> HBase it's monitoring?
> It could try proming for some known MBeans and deduce HBase 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 HBase.
>
> Thanks,
> Otis
> --
> Monitoring * Alerting * Anomaly Detection * Centralized Log Management
> Solr & Elasticsearch Support * http://sematext.com/
>
>
> On Wed, Nov 12, 2014 at 4:41 PM, Ted Yu <yu...@gmail.com> wrote:
>
> > Using hbase shell:
> >
> > hbase(main):002:0> status 'detailed'
> > version 0.98.4.2-hadoop2
> >
> > Cheers
> >
> > On Wed, Nov 12, 2014 at 1:37 PM, Otis Gospodnetic <
> > otis.gospodnetic@gmail.com> wrote:
> >
> > > Hi,
> > >
> > > Is there a way to detect which version of HBase 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?
> > >
> > > Thanks,
> > > Otis
> > > --
> > > Monitoring * Alerting * Anomaly Detection * Centralized Log Management
> > > Solr & Elasticsearch Support * http://sematext.com/
> > >
> >
>

Re: Programmatic HBase version detection/extraction

Posted by Otis Gospodnetic <ot...@gmail.com>.
Hi Ted,

Thanks, but I'm looking for something I can grab programmatically (not
manually), for example from a Java app.  Maybe there is some API that
exposes this information or an MBean?

Here's the use case:
SPM monitors HBase <http://sematext.com/spm/>, but HBase MBeans and metrics
have changed 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
HBase it's monitoring?
It could try proming for some known MBeans and deduce HBase 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 HBase.

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


On Wed, Nov 12, 2014 at 4:41 PM, Ted Yu <yu...@gmail.com> wrote:

> Using hbase shell:
>
> hbase(main):002:0> status 'detailed'
> version 0.98.4.2-hadoop2
>
> Cheers
>
> On Wed, Nov 12, 2014 at 1:37 PM, Otis Gospodnetic <
> otis.gospodnetic@gmail.com> wrote:
>
> > Hi,
> >
> > Is there a way to detect which version of HBase 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?
> >
> > Thanks,
> > Otis
> > --
> > Monitoring * Alerting * Anomaly Detection * Centralized Log Management
> > Solr & Elasticsearch Support * http://sematext.com/
> >
>

Re: Programmatic HBase version detection/extraction

Posted by Ted Yu <yu...@gmail.com>.
Using hbase shell:

hbase(main):002:0> status 'detailed'
version 0.98.4.2-hadoop2

Cheers

On Wed, Nov 12, 2014 at 1:37 PM, Otis Gospodnetic <
otis.gospodnetic@gmail.com> wrote:

> Hi,
>
> Is there a way to detect which version of HBase 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?
>
> Thanks,
> Otis
> --
> Monitoring * Alerting * Anomaly Detection * Centralized Log Management
> Solr & Elasticsearch Support * http://sematext.com/
>

Re: Programmatic HBase version detection/extraction

Posted by Otis Gospodnetic <ot...@gmail.com>.
Hi,

Thanks Gary, I think this is exactly what I was after!
Btw. might be nice to expose this via JMX, too, for apps who needs this
info but are not in process.

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


On Wed, Nov 12, 2014 at 4:44 PM, Gary Helmling <gh...@gmail.com> wrote:

> Yes, you can use the org.apache.hadoop.hbase.util.VersionInfo class.
>
> From java code, you can use VersionInfo.getVersion().  From shell
> scripts, you can just run "hbase version" and parse the output.
>
> On Wed, Nov 12, 2014 at 1:37 PM, Otis Gospodnetic
> <ot...@gmail.com> wrote:
> > Hi,
> >
> > Is there a way to detect which version of HBase 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?
> >
> > Thanks,
> > Otis
> > --
> > Monitoring * Alerting * Anomaly Detection * Centralized Log Management
> > Solr & Elasticsearch Support * http://sematext.com/
>

Re: Programmatic HBase version detection/extraction

Posted by Gary Helmling <gh...@gmail.com>.
Yes, you can use the org.apache.hadoop.hbase.util.VersionInfo class.

>From java code, you can use VersionInfo.getVersion().  From shell
scripts, you can just run "hbase version" and parse the output.

On Wed, Nov 12, 2014 at 1:37 PM, Otis Gospodnetic
<ot...@gmail.com> wrote:
> Hi,
>
> Is there a way to detect which version of HBase 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?
>
> Thanks,
> Otis
> --
> Monitoring * Alerting * Anomaly Detection * Centralized Log Management
> Solr & Elasticsearch Support * http://sematext.com/