public virtual void SetupCluster()
        {
            SecurityUtilTestHelper.SetTokenServiceUseIp(true);
            conf.SetBoolean(DFSConfigKeys.DfsNamenodeDelegationTokenAlwaysUseKey, true);
            conf.Set(CommonConfigurationKeysPublic.HadoopSecurityAuthToLocal, "RULE:[2:$1@$0](JobTracker@.*FOO.COM)s/@.*//"
                     + "DEFAULT");
            cluster = new MiniDFSCluster.Builder(conf).NnTopology(MiniDFSNNTopology.SimpleHATopology
                                                                      ()).NumDataNodes(0).Build();
            cluster.WaitActive();
            string logicalName = HATestUtil.GetLogicalHostname(cluster);

            HATestUtil.SetFailoverConfigurations(cluster, conf, logicalName, 0);
            nn0 = cluster.GetNameNode(0);
            nn1 = cluster.GetNameNode(1);
            fs  = HATestUtil.ConfigureFailoverFs(cluster, conf);
            dfs = (DistributedFileSystem)fs;
            cluster.TransitionToActive(0);
            dtSecretManager = NameNodeAdapter.GetDtSecretManager(nn0.GetNamesystem());
        }
        public virtual void TestHarUriWithHaUriWithNoPort()
        {
            Configuration  conf    = new HdfsConfiguration();
            MiniDFSCluster cluster = null;

            try
            {
                cluster = new MiniDFSCluster.Builder(conf).NumDataNodes(1).NnTopology(MiniDFSNNTopology
                                                                                      .SimpleHATopology()).Build();
                cluster.TransitionToActive(0);
                HATestUtil.SetFailoverConfigurations(cluster, conf);
                CreateEmptyHarArchive(HATestUtil.ConfigureFailoverFs(cluster, conf), TestHarPath);
                URI  failoverUri = FileSystem.GetDefaultUri(conf);
                Path p           = new Path("har://hdfs-" + failoverUri.GetAuthority() + TestHarPath);
                p.GetFileSystem(conf);
            }
            finally
            {
                cluster.Shutdown();
            }
        }
Пример #3
0
        public virtual void TestHaFsck()
        {
            Configuration conf = new Configuration();
            // need some HTTP ports
            MiniDFSNNTopology topology = new MiniDFSNNTopology().AddNameservice(new MiniDFSNNTopology.NSConf
                                                                                    ("ha-nn-uri-0").AddNN(new MiniDFSNNTopology.NNConf("nn1").SetHttpPort(10051)).AddNN
                                                                                    (new MiniDFSNNTopology.NNConf("nn2").SetHttpPort(10052)));
            MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).NnTopology(topology).NumDataNodes
                                         (0).Build();
            FileSystem fs = null;

            try
            {
                cluster.WaitActive();
                cluster.TransitionToActive(0);
                // Make sure conf has the relevant HA configs.
                HATestUtil.SetFailoverConfigurations(cluster, conf, "ha-nn-uri-0", 0);
                fs = HATestUtil.ConfigureFailoverFs(cluster, conf);
                fs.Mkdirs(new Path("/test1"));
                fs.Mkdirs(new Path("/test2"));
                RunFsck(conf);
                cluster.TransitionToStandby(0);
                cluster.TransitionToActive(1);
                RunFsck(conf);
            }
            finally
            {
                if (fs != null)
                {
                    fs.Close();
                }
                if (cluster != null)
                {
                    cluster.Shutdown();
                }
            }
        }
Пример #4
0
 /// <exception cref="System.IO.IOException"/>
 private void RunFinalizeCommand(MiniDFSCluster cluster)
 {
     HATestUtil.SetFailoverConfigurations(cluster, conf);
     new DFSAdmin(conf).FinalizeUpgrade();
 }