Exemple #1
0
        /// <summary>
        /// Derive the namenode http address from the current file system,
        /// either default or as set by "-fs" in the generic options.
        /// </summary>
        /// <returns>Returns http address or null if failure.</returns>
        /// <exception cref="System.IO.IOException">if we can't determine the active NN address
        ///     </exception>
        private URI GetCurrentNamenodeAddress(Path target)
        {
            //String nnAddress = null;
            Configuration conf = GetConf();
            //get the filesystem object to verify it is an HDFS system
            FileSystem fs = target.GetFileSystem(conf);

            if (!(fs is DistributedFileSystem))
            {
                System.Console.Error.WriteLine("FileSystem is " + fs.GetUri());
                return(null);
            }
            return(DFSUtil.GetInfoServer(HAUtil.GetAddressOfActive(fs), conf, DFSUtil.GetHttpClientScheme
                                             (conf)));
        }