使用带有HDInsight的Apache Mahout运行电影推荐时出错

时间:2015-04-05 06:45:09

标签: azure mahout hdinsight

我运行以下代码但收到错误...

# The HDInsight cluster name.
$clusterName = "my-cluster-name"

Use-AzureHDInsightCluster $clusterName

# NOTE: The version number portion of the file path
# may change in future versions of HDInsight.
# So dynamically grab it using Hive.
$mahoutPath = Invoke-Hive -Query '!${env:COMSPEC} /c dir /b /s ${env:MAHOUT_HOME}\examples\target\*-job.jar' | where {$_.startswith("C:\apps\dist")}
$mahoutPath = $mahoutPath -replace "\\", "/"
$jarFile = "file:///$mahoutPath"
#
# If you are using an earlier version of HDInsight,
# set $jarFile to the jar file you
# uploaded.
# For example,
# $jarFile = "wasb:///example/jars/mahout-core-0.9-job.jar"

# The arguments for this job
# * input - the path to the data uploaded to HDInsight
# * output - the path to store output data
# * tempDir - the directory for temp files
$jobArguments = "-s", "SIMILARITY_COOCCURRENCE",
                "--input", "wasb:///u.data",
                "--output", "wasb:///example/out",
                "--tempDir", "wasb:///temp/mahout"

# Create the job definition
$jobDefinition = New-AzureHDInsightMapReduceJobDefinition `
  -JarFile $jarFile `
  -ClassName "org.apache.mahout.cf.taste.hadoop.item.RecommenderJob" `
  -Arguments $jobArguments

# Start the job
$job = Start-AzureHDInsightJob -Cluster $clusterName -JobDefinition $jobDefinition

# Wait on the job to complete
Write-Host "Wait for the job to complete ..." -ForegroundColor Green
Wait-AzureHDInsightJob -Job $job

# Write out any error information
Write-Host "STDERR"
Get-AzureHDInsightJobOutput -Cluster $clusterName -JobId $job.JobId -StandardError

我已使用azure storage explorer将u.data文件上传到包含hdinsight文件的容器的根目录。

我在行收到错误..

PS C:> $ job = Start-AzureHDInsightJob -Cluster $ clusterName -JobDefinition $ jobDefinition

错误:

Start-AzureHDInsightJob:请求失败,代码为:InternalServerError 内容:{"错误":空} 在行:1字符:8 + $ job = Start-AzureHDInsightJob -Cluster $ clusterName -JobDefinition $ jobDefiniti ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo:未指定:(:) [Start-AzureHDInsightJob],HttpLayerException     + FullyQualifiedErrorId:Microsoft.WindowsAzure.Management.HDInsight.Framework.Core.Library.WebRequest.HttpLayerE    xception,Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.PSCmdlets.StartAzureHDInsightJobCmdlet

任何帮助都是真诚的指定..

由于

1 个答案:

答案 0 :(得分:0)

这看起来是HDInsight群集上Hive / Templeton的最近更改,现在它在文件路径的末尾返回CRLF。我将脚本更改为以下内容以修复它:

$mahoutPath = Invoke-Hive -Query '!${env:COMSPEC} /c dir /b /s ${env:MAHOUT_HOME}\examples\target\*-job.jar' | where {$_.startswith("C:\apps\dist")}
$noCRLF = $mahoutPath -replace "`r`n", ""
$cleanedPath = $noCRLF -replace "\\", "/"
$jarFile = "file:///$cleanedPath"