2017-04-21 68 views
1

我正在尝试使用Azure数据工厂创建使用Hdi 3.5版的按需HD高清洞察Spark群集。数据工厂拒绝用一个错误信息来创建如何根据需要创建Azure HD高清洞察使用数据工厂的Spark群集

HdiVersion:“3.5”不支持

如果当前没有需求HD洞察火花集群上创建的方式又是什么另一个明智的选择?对我来说,这似乎很奇怪,为什么微软没有在Azure数据工厂中添加一个按需HD高清洞察Spark Cluster。

+0

您是否曾向Microsoft提出过支持凭单?我们没有太多可以做的事情。如果目前不支持,那就是答案! –

+0

我没有提出这与微软。即使我这样做,我仍然需要为我的客户实施一项解决方案,以便能够按需启动集群。这个问题包含两个部分:1)数据工厂不支持按需Spark集群2)如果Number 1为true,那么是否有任何解决方法? – jane

回答

0

恐怕目前不支持按需Spark,但它绝对在路线图中。敬请期待。

作为现在的解决方法,您可以尝试使用ADF CustomActivity以您的自定义代码创建/删除Spark群集。

+0

有关何时可能实施的任何提示? – Roelant

0

Azure目前不支持Spark活动的On Demand HDInsight群集创建。因为你所要求的解决方法,这里是我做的:

  1. 带HDInsight群集起来使用PowerShell自动化&调度(运行手册),大约需要20分钟的HDI做好准备。
  2. 从Data Factory提交Spark批处理作业,比HDI计划晚约30分钟。
  3. 30分钟后删除HDI群集 - 预计作业完成时间为1小时。

我知道很多简单任务的工作,但现在可以工作。

1

下面是一个完整的解决方案,该解决方案使用ADF在C#中调度Custom .NET活动,后者又使用ARM模板和SSH.NET执行运行R脚本的命令。

因此,ADF用于调度.NET活动,批处理服务用于运行dll中的代码,然后HDInsight群集的json模板文件将存储在blob中,并可根据需要进行配置。

的完整描述是文章“Automating Azure: Creating an On-Demand HDInsight Cluster”的,但在这里是C#代码是自动化的本质(一切只是管理工作设置了位):

using System; 
    using System.Collections.Generic; 
using Microsoft.Azure.Management.DataFactories.Models; 
using Microsoft.Azure.Management.DataFactories.Runtime; 

using Microsoft.Azure.Management.ResourceManager.Fluent; 

using Microsoft.Azure.Management.ResourceManager.Fluent.Core; 

using Renci.SshNet; 

namespace VM 

{ 
    public class StartVM : IDotNetActivity 
    { 
     private IActivityLogger _logger; 
     public IDictionary<string, string> Execute(
      IEnumerable<LinkedService> linkedServices, 
      IEnumerable<Dataset> datasets, 
      Activity activity, 
      IActivityLogger logger) 
     { 
      _logger = logger; 
      _logger.Write("Starting execution..."); 
      var credentials = SdkContext.AzureCredentialsFactory.FromServicePrincipal(
       "" // enter clientId here, this is the ApplicationID 
       , "" // this is the Application secret key 
       , "" // this is the tenant id 
       , AzureEnvironment.AzureGlobalCloud); 
      var azure = Microsoft.Azure.Management.Fluent.Azure 
       .Configure() 
       .WithLogLevel(HttpLoggingDelegatingHandler.Level.Basic) 
       .Authenticate(credentials) 
       .WithDefaultSubscription(); 
      var groupName = "myResourceGroup"; 
      var location = Region.EuropeNorth; 
      // create the resource group 
      var resourceGroup = azure.ResourceGroups.Define(groupName) 
       .WithRegion(location) 
       .Create(); 
      // deploy the template 
      var templatePath = "https://myblob.blob.core.windows.net/blobcontainer/myHDI_template.JSON"; 
      var paramPath = "https:// myblob.blob.core.windows.net/blobcontainer /myHDI_parameters.JSON"; 
      var deployment = azure.Deployments.Define("myDeployment") 
       .WithExistingResourceGroup(groupName) 
       .WithTemplateLink(templatePath, "0.9.0.0") // make sure it matches the file 
       .WithParametersLink(paramPath, "1.0.0.0") // make sure it matches the file 
       .WithMode(Microsoft.Azure.Management.ResourceManager.Fluent.Models.DeploymentMode.Incremental) 
       .Create(); 
    _logger.Write("The cluster is ready..."); 
      executeSSHCommand(); 
      _logger.Write("The SSH command was executed..."); 
      _logger.Write("Deleting the cluster..."); 
      // delete the resource group 
      azure.ResourceGroups.DeleteByName(groupName); 

      return new Dictionary<string, string>(); 
     } 
     private void executeSSHCommand() 
     { 
      ConnectionInfo ConnNfo = new ConnectionInfo("myhdi-ssh.azurehdinsight.net", "sshuser", 
       new AuthenticationMethod[]{ 
       // Pasword based Authentication 
       new PasswordAuthenticationMethod("sshuser","[email protected]"), 
       } 
     ); 
      // Execute a (SHELL) Command - prepare upload directory 
      using (var sshclient = new SshClient(ConnNfo)) 
      { 
       sshclient.Connect(); 
       using (var cmd = sshclient.CreateCommand(
        "hdfs dfs -copyToLocal \"wasbs:///rscript/test.R\";env -i R CMD BATCH --no-save --no-restore \"test.R\"; hdfs dfs -copyFromLocal -f \"test-output.txt\" \"wasbs:///rscript/test-output.txt\" ")) 
       { 
        cmd.Execute(); 

       } 
       sshclient.Disconnect(); 
      } 
     } 
    } 

    } 

好运!

Feodor