Exemplo n.º 1
0
        static void Main(string[] args)
        {
            string filename     = ReadFilename();
            string hdfsFilename = "/tmp/" + Path.GetFileName(filename) + ".dotnet";

            var webhdfs = new WebHDFSClient(ReadWebHDFSAPI(),
                                            new NetworkCredential(ReadUsername(), ReadPassword()));

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            Console.WriteLine("Starting to upload file - " + filename);

            var result = webhdfs.UploadFile(
                filename,
                hdfsFilename,
                overwrite: true
                ).Result;

            Console.WriteLine("Upload successful?: " + result);
            Console.WriteLine("Finished uploading file - " + filename);

            stopWatch.Stop();
            Console.WriteLine("Time Elapsed: " + stopWatch.Elapsed);

            Console.WriteLine("File info: " + webhdfs.GetFileStatus(hdfsFilename).Result);
        }