简体   繁体   English

Azure 上的 Node.js 和 HBase (HDInsight)

[英]Node.js and HBase on Azure (HDInsight)

I am trying to access HBase on Microsoft's Azure from Node.js.我正在尝试从 Node.js 访问 Microsoft Azure 上的 HBase。 I looked at different libraries such as hbase and also the REST API (webhcat).我查看了不同的库,例如 hbase 和 REST API (webhcat)。 What I want to achieve is to create a table and upload data from Node.我想要实现的是创建一个表并从 Node.js 上传数据。 Later I want to do queries on this dataset.后来我想对这个数据集进行查询。 Unfortunately the documentation from Azure is not very helpful in this matter, as it focuses on PowerShell and the .NET SDK.不幸的是,Azure 的文档在这方面并没有多大帮助,因为它侧重于 PowerShell 和 .NET SDK。

One quite helpful article I found is this: http://blogs.msdn.com/b/bigdatasupport/archive/2014/04/22/querying-hdinsight-job-status-with-webhcat-via-native-powershell-or-node-js.aspx Querying the job status works fine for me, but I am a bit stuck when it comes to adapting the request in order to upload and query data.我发现的一篇很有帮助的文章是: http : //blogs.msdn.com/b/bigdatasupport/archive/2014/04/22/querying-hdinsight-job-status-with-webhcat-via-native-powershell-or -node-js.aspx查询作业状态对我来说很好用,但是在调整请求以上传和查询数据时我有点卡住了。 Is this even possible with using the webhcat (former templeton) API?使用 webhcat(以前的 Templeton)API 甚至可以做到这一点吗?

This azure page describes how to use hive or the REST API to interact with HBase on HDInsight: http://azure.microsoft.com/en-us/documentation/articles/hdinsight-hbase-get-started/#hive-query However, I don't know if it is possible to do this with node.js rather than the PowerShell?这个 azure 页面描述了如何使用 hive 或 REST API 与 HDInsight 上的 HBase 进行交互: http ://azure.microsoft.com/en-us/documentation/articles/hdinsight-hbase-get-started/#hive-query 但是,我不知道是否可以使用 node.js 而不是 PowerShell 来做到这一点?

I would be very thankful for any thoughts and leads in the right direction!!我将非常感谢任何想法和正确方向的引导!!

You can use the HBase REST API on HDInsight, but you have to prepend /hbaserest/ to it.您可以在 HDInsight 上使用 HBase REST API,但必须在它前面加上 /hbaserest/。

You also need to provide basic auth credentials, which are those provided when you create the cluster.您还需要提供基本的身份验证凭据,这些凭据是在创建集群时提供的凭据。 This should also work with any valid hadoop user on the cluster.这也适用于集群上的任何有效 hadoop 用户。

The endpoint is: https://[clustername].azurehdinsight.net/hbaserest/端点是: https://[clustername].azurehdinsight.net/hbaserest/

The rest of the REST API is documented here: https://wiki.apache.org/hadoop/Hbase/Stargate REST API 的其余部分记录在此处: https : //wiki.apache.org/hadoop/Hbase/Stargate

So for example in node:例如在节点中:

var superagent = require('superagent')
superagent.get('https://clustername.azurehdinsight.net/hbaserest/my_table/schema')
.auth(username, password)
.end(function(err, result) {
    console.log(result.text)
})

There is an NPM modules for hbase, but it currently (v 0.1.7) doesn't support authentication, or SSL, both of which are required for the HDInsight Hbase clusters. hbase 有一个 NPM 模块,但它目前 (v 0.1.7) 不支持身份验证或 SSL,这两者都是 HDInsight Hbase 群集所必需的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM