C # Map Reduce не работает с {Код состояния ответа не указывает на успех: 403 (Запрещено). "} Иногда 401: требуются учетные данные

Необработанное исключение типа System.AggregateException произошло в mscorlib.dll

Внутреннее исключение: {"Response status code does not indicate success: 403 (Forbidden)."} иногда получают: {"Response status code does not indicate success: 401 (Credentials required)."}

Все логины правильные. Hadoop.Connect () подключается правильно.

Трассировки стека:

в System.Threading.Tasks.Task.ThrowIfExceptional (Boolean includeTaskCanceledExceptions) в System.Threading.Tasks.Task.Wait (Int32 millisecondsTimeout, CancellationToken cancellationToken) в System.Threading.Tasks.Task.Waientoop () в Microsoft.Web. WebHCatClient.WebHcatMapReduceStreamingExecutor.Execute (логическое throwOnError) в Microsoft.Hadoop.MapReduce.Execution.Hadoop.StreamingJobExecutorBase.ExecuteCore (преобразователь типов, редуктор типов, объединение типов. StreamingJobExecutorBase.Execute (тип mapperType, тип reducerType, тип combinerType, конфигурация HadoopJobConfiguration) в Microsoft.Hadoop.MapReduce.Execution.Hadoop.StreamingJobExecutorBase.Execute [TMapper.Configuration.Manager (HADO). String [] args) в C: \ ASC Project Info \ TalentExchange \ Demo project \ Pwc.Demo.HDPClient \ Pwc.Demo.HDPClient \ Program.cs: строка 49 в System.AppDomain._nExecuteAssembly (сборка RuntimeAssembly, String [] args) в System.AppDomain.ExecuteAssembly (String assemblyFile, Evidence assemblySecurity, String [] args) в Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly ()
в System .Threading.ThreadHelper.ThreadStart_Context (состояние объекта)
в System.Threading.ExecutionContext.RunInternal (ExecutionContext executionContext, обратный вызов ContextCallback, состояние объекта, логическое значение preserveSyncCtx) в System.Threading.ExecutionContext.Run (ExecutionContext ExecutionContext. состояние, логическое preserveSyncCtx) в System.Threading.ExecutionContext.Run (ExecutionContext executionContext, обратный вызов ContextCallback, состояние объекта) в System.Threading.ThreadHelper.ThreadStart ()

class Program
       {
            static void Main(string[] args)
           {
              HadoopJobConfiguration myConfig = new   HadoopJobConfiguration();

            myConfig.InputPath = "asv://hdsto-something-.net/data/in/reviews.txt";
            myConfig.OutputFolder = "asv://hd-something-.blob.core.windows.net/data/out/";
            Environment.SetEnvironmentVariable("HADOOP_HOME", @"C:\apps\dist\hadoop-2.7.1.2.3.3.1-25\bin");
            Environment.SetEnvironmentVariable("JAVA_HOME", @"C:\Program Files\Java\jre1.8.0_101\bin\javaw.exe");

            Uri azureCluster = new Uri("https://somename--Demo.azurehdinsight.net");
            string clusterUserName = "***";
            string clusterPassword = "****";

            // This is the name of the account under which Hadoop will execute jobs.
            // Normally this is just "Hadoop".
            string hadoopUserName = "Hadoop";

            // Azure Storage Information.
            string azureStorageAccount = "somestore.blob.core.windows.net";
            string azureStorageKey = "***==";
            string azureStorageContainer = "**";
            bool createContinerIfNotExist = false;

            IHadoop myCluster = Hadoop.Connect(azureCluster,
                                        clusterUserName,
                                        hadoopUserName,
                                        clusterPassword,
                                        azureStorageAccount,
                                        azureStorageKey,
                                        azureStorageContainer,
                                        createContinerIfNotExist);

            //execute mapreduce job

            MapReduceResult jobResult =

                myCluster.MapReduceJob.Execute<MySimpleMapper, MySimpleReducer>(myConfig);

            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();
        }
    }

    public class MySimpleMapper : MapperBase
    {
        public override void Map(string inputLine, MapperContext context)
        {
            int value = int.Parse(inputLine);
            string key = (value % 2 == 0) ? "even" : "odd";
            context.EmitKeyValue(key, value.ToString());
        }
    }

    public class MySimpleReducer : ReducerCombinerBase
    {
        public override void Reduce(string key, IEnumerable<string> values, ReducerCombinerContext context)
        {
            //initialize counters
            int myCount = 0;
            int mySum = 0;
            //count and sum incoming values
            foreach (string value in values)
            {
                mySum += int.Parse(value);
                myCount++;
            }
            context.EmitKeyValue(key, myCount + "t" + mySum);

        }
    }

Снимок ошибки:  введите описание изображения здесь


person NAS    schedule 02.09.2016    source источник


Ответы (1)


Ваш входной путь должен быть не к конкретному файлу, а к каталогу. Этот каталог должен содержать только файлы, а не папки.

myConfig.InputPath = "asv://hdsto-something-.net/data/in/";
person Andrew Moll    schedule 07.09.2016
comment
Я изменил его на: myConfig.InputPath = asv: //[email protected]/user/hduser/in/; myConfig.OutputFolder = sv: //[email protected]/user/hduser/out/; Во входной папке я добавил текстовый файл. Выполнено задание C #, но я получаю те же учетные данные для ошибки. - person NAS; 07.09.2016