使用 Hadoop.WebHDFSClient 创建文件时出现 403,尽管能够在 HDFS 中创建文件夹

403 on file creation while using Hadoop.WebHDFSClient, Although was able to create Folders in HDFS

此代码一直有效,直到创建文件夹,然后无法创建文件并抛出 403。我是否遗漏了一些用于身份验证的内容。我是 Hadoop 的新手,正在尝试学习 hdInsight。

    private static void uploadFile()
    {
        //set variables
        string srcFileName = @"./prime/in/integers.txt";
        string destFolderName = @"/prime/in";
        string destFileName = @"integers.txt";
        string outputFolderName= @"/prime/out";
        //connect to hadoop cluster
        Uri myUri = new Uri("http://DXPZN72-LP:50070");
        string userName = "hadoop";
        WebHDFSClient myClient = new WebHDFSClient(myUri, userName);

        //drop destination directory (if exists)
        myClient.DeleteDirectory(destFolderName, true).Wait();

        //create destination directory
        myClient.CreateDirectory(destFolderName).Wait();

        //create outputFolderName directory
        myClient.CreateDirectory(outputFolderName).Wait();

        //load file to destination directory
        var res= myClient.CreateFile(srcFileName,  "/" +destFileName);
        res.Wait();
        //list file contents of destination directory
        Console.WriteLine();
        Console.WriteLine("Contents of " +destFolderName);

        myClient.GetDirectoryStatus(destFolderName).ContinueWith(
             ds => ds.Result.Files.ToList().ForEach(
             f => Console.WriteLine("t" +f.PathSuffix)
             ));

        //keep command window open until user presses enter
        Console.ReadLine();
    }

发现这是一项需要的服务restarted.Although我能够创建文件夹,但无法创建带有 403 的文件。

我重新启动了我的机器,然后再次尝试,问题消失了,我也能够创建文件了。