I'm using Node.js Thrift API to connect to Hbase. Everything was working great until I upgraded CDH 4.6 to CDH 5. After upgrading I regenerated the Thrift API for Node.js with this script:

thrift --gen js:node /opt/cloudera/parcels/CDH-5.0.0-1.cdh5.0.0.p0.47/lib/hbase/include/thrift/hbase2.thrift

After replacing the original Node.js script with the newly generated script, everything stopped working.

You can view the new script and the basic methods in the demo that I'm trying to run on https://github.com/lgrcyanny/Node-HBase-Thrift2

When I run the 'get' method, it returns "Internal error processing get".

When I run the 'put' method, it returns "Invalid method name: 'put'".

It seems like the new Thrift API is completely incompatible? Am I missing anything here?

有帮助吗?

解决方案

There are two Thrift IDL files that come with HBase:

Both have a get() method, but only one of them has a put() method, which is exactly what your error messages above are telling us.

Cited from the package summary page:

There are currently 2 thrift server implementations in HBase, the packages:

  • org.apache.hadoop.hbase.thrift: This may one day be marked as depreceated.

  • org.apache.hadoop.hbase.thrift2: i.e. this package. This is intended to closely match to the HTable interface and to one day supercede the older thrift (the old thrift mimics an API HBase no longer has).

Also the install guides have a separate section for that scenario:

CDH 5 HBase Compatibility

CDH 5 HBase is [...] not wire compatible with CDH 4 [...]. Consequently, rolling upgrades from CDH 4 to CDH 5 are not possible because existing CDH 4 HBase clients cannot make requests to CDH 5 servers and CDH 5 HBase clients cannot make requests to CDH 4 servers. Clients of the Thrift and REST proxy servers, however, retain wire compatibility between CDH 4 and CDH 5. [...]

The HBase User API (Get, Put, Result, Scanner etc; see Apache HBase API documentation) has evolved and attempts have been made to make sure the HBase Clients are source code compatible and thus should recompile without needing any source code modifications. This cannot be guaranteed however, since with the conversion to ProtoBufs, some relatively obscure APIs have been removed. Rudimentary efforts have also been made to preserve recompile compatibility with advanced APIs such as Filters and Coprocessors. These advanced APIs are still evolving and our guarantees for API compatibility are weaker here.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top