Exemple #1
0
        public virtual void TestWebHdfsEnabledByDefault()
        {
            Configuration conf = new HdfsConfiguration();

            NUnit.Framework.Assert.IsTrue(conf.GetBoolean(DFSConfigKeys.DfsWebhdfsEnabledKey,
                                                          false));
        }
        public NNHAServiceTarget(Configuration conf, string nsId, string nnId)
        {
            // Keys added to the fencing script environment
            Preconditions.CheckNotNull(nnId);
            if (nsId == null)
            {
                nsId = DFSUtil.GetOnlyNameServiceIdOrNull(conf);
                if (nsId == null)
                {
                    throw new ArgumentException("Unable to determine the nameservice id.");
                }
            }
            System.Diagnostics.Debug.Assert(nsId != null);
            // Make a copy of the conf, and override configs based on the
            // target node -- not the node we happen to be running on.
            HdfsConfiguration targetConf = new HdfsConfiguration(conf);

            NameNode.InitializeGenericKeys(targetConf, nsId, nnId);
            string serviceAddr = DFSUtil.GetNamenodeServiceAddr(targetConf, nsId, nnId);

            if (serviceAddr == null)
            {
                throw new ArgumentException("Unable to determine service address for namenode '"
                                            + nnId + "'");
            }
            this.addr = NetUtils.CreateSocketAddr(serviceAddr, NameNode.DefaultPort);
            this.autoFailoverEnabled = targetConf.GetBoolean(DFSConfigKeys.DfsHaAutoFailoverEnabledKey
                                                             , DFSConfigKeys.DfsHaAutoFailoverEnabledDefault);
            if (autoFailoverEnabled)
            {
                int port = DFSZKFailoverController.GetZkfcPort(targetConf);
                if (port != 0)
                {
                    SetZkfcPort(port);
                }
            }
            try
            {
                this.fencer = NodeFencer.Create(targetConf, DFSConfigKeys.DfsHaFenceMethodsKey);
            }
            catch (BadFencingConfigurationException e)
            {
                this.fenceConfigError = e;
            }
            this.nnId = nnId;
            this.nsId = nsId;
        }