如何从基于linux的Hadoop客户端使用Azure blob存储?

如何从基于linux的Hadoop客户端使用Azure blob存储?,linux,azure,hadoop,Linux,Azure,Hadoop,以下是我的设置: HDInsights Hadoop群集与wasb://mybucket设置为默认FS 安装了HDP 2.2 RPM软件包的CentOS虚拟机。(我们称之为client1) 我想做的是: local1 > ssh client1 client1> hadoop fs -ls / #list contents of blob storage bucket. 我已将以下密钥从hdinsights head节点上的core-site.xml复制到/etc/hadoop/c

以下是我的设置:

  • HDInsights Hadoop群集与
    wasb://mybucket
    设置为默认FS
  • 安装了HDP 2.2 RPM软件包的CentOS虚拟机。(我们称之为client1)
  • 我想做的是:

    local1 > ssh client1
    client1> hadoop fs -ls / #list contents of blob storage bucket.
    
    我已将以下密钥从hdinsights head节点上的core-site.xml复制到
    /etc/hadoop/conf/core-site.xml

    • 财政司司长wasb://...
    • fs.azure.account.key.mybucket.blob.core.windows.net-随机字符串
    • fs.azure.account.keyprovider.mybucket.blob.core.windows.net-
      …ShellDecryptionKeyProvider
    不幸的是,这需要调用一个
    ShellDecryptionKeyProvider
    。在windows上,这是一个命令行可执行文件。我不知道如何为linux提供这一功能

    以下是输出:

    [rathboma@client1 yum.repos.d]$ hadoop fs -ls /
    15/03/04 23:02:12 INFO impl.MetricsConfig: loaded properties from hadoop-metrics2.properties
    15/03/04 23:02:13 INFO impl.MetricsSystemImpl: Scheduled snapshot period at 10 second(s).
    15/03/04 23:02:13 INFO impl.MetricsSystemImpl: azure-file-system metrics system started
    ls: org.apache.hadoop.fs.azure.KeyProviderException: Script path is not specified via fs.azure.shellkeyprovider.script
    

    是否有人能够从Azure上的linux机器与blob存储进行通信?我需要如何配置它?

    与其尝试使用Hadoop fs命令,不如直接访问存储?如果您仔细看一下,就会发现您可以通过节点直接访问blob存储,而不必依赖Hadoop类。以下示例应列出存储容器中的所有文件/blob:

    var account = 'storaccount' // This is just the first part of the storage account name (the part before the first '.'')
    var key = 'BASE64KEYGOESHERE==' // Retrieve the key from the Storage section of the Azure Portal
    var container = 'clustercontainer' // this is the container name associated with the cluster
    
    var azure = require('azure-storage');
    var blobService = azure.createBlobService(account,key);
    var i = 0;
    var ct=null;
    do {
          blobService.listBlobsSegmented(container, ct, function(error, result, response){
              if(!error){
                  i++;
                  console.log("Result set", i, ":")
                  for(var blob in result.entries) { console.log(result.entries[blob].name); }
                  console.log("Continuation? : ", result.continuationToken);
                  ct = result.continuationToken;
              } else {
                  ct = null;
                  console.log("Error:");
                  console.log(error);
              }
          });
    } while(ct);
    
    还有其他几种API可供使用(,),或者跨平台CLI()可能更适合,具体取决于您需要如何与存储交互


    如果您确实想尝试从client1中使用Hadoop fs函数,可以尝试从client1的设置文件中删除
    fs.azure.account.keyprovider.mybucket.blob.core.windows.net
    属性,然后将未加密的存储访问密钥放入
    fs.azure.account.key.mybucket.blob.core.windows.net
    。如果未指定密钥提供程序,则应按原样使用访问密钥。

    这是一个有趣的建议,但完全不能回答问题。您为什么这样认为?我提供了加密密钥(依赖ShellDecryptionKeyProvider)无法直接工作的原因,提供了在不经过Hadoop wasb实现的情况下访问blob存储的替代方案,然后还提供了一种使用未加密密钥使Hadoop wasb实现在client1上工作的方法。ha,错过了关于使用未加密密钥的段落。也许这应该是最重要的。