尝试在 Hadoop 集群上运行 MapReduce 作业时遇到一个奇怪的异常。这里有趣的是我可以访问 HDFS,但无法运行作业。
UriBuilder uriBuilder = new UriBuilder("192.168.16.132");
uriBuilder.Port = 8021;//8082;
var hadoop = Hadoop.Connect(uriBuilder.Uri, "username", "password");
hadoop.StorageSystem.MakeDirectory("user/username/test"); //This works
//establish job configuration
HadoopJobConfiguration myConfig = new HadoopJobConfiguration();
myConfig.InputPath = "/user/username/input";
myConfig.OutputFolder = "/user/username/output";
try
{
//connect to cluster
MapReduceResult jobResult = hadoop.MapReduceJob.Execute<MySimpleMapper, MySimpleReducer>(myConfig); //This does not work and produces an error: The remote name could not be resolved
//write job result to console
int exitCode = jobResult.Info.ExitCode;
string exitStatus = "Failure";
if (exitCode == 0) exitStatus = "Success";
exitStatus = exitCode + " (" + exitStatus + ")";
Console.WriteLine();
Console.Write("Exit Code = " + exitStatus);
Console.Read();
}
catch (Exception exc)
{
//Error sending request.
}
我正在使用 Hortonworks 沙箱进行测试,如果它有什么不同的话。确切的错误是:“无法解析远程名称:'sandbox'”。
谁能解释为什么会发生这种情况以及我能做些什么来解决它?
编辑:我已通过将 Hadoop 集群的 IP 添加到主机文件来解决此问题,但是现在我收到以下异常:“响应状态代码不表示成功:500(服务器错误)。”