예제 #1
0
 public virtual void Setup()
 {
     mockProtocol     = MockitoUtil.MockProtocol <HAServiceProtocol>();
     mockZkfcProtocol = MockitoUtil.MockProtocol <ZKFCProtocol>();
     tool             = new _DFSHAAdmin_118(this);
     // OVerride the target to return our mock protocol
     // mock setup doesn't really throw
     tool.SetConf(GetHAConf());
     tool.SetErrOut(new TextWriter(errOutBytes));
     tool.SetOut(new TextWriter(outBytes));
 }
예제 #2
0
 public virtual void Setup()
 {
     conf    = new Configuration();
     cluster = new MiniDFSCluster.Builder(conf).NnTopology(MiniDFSNNTopology.SimpleHATopology
                                                               ()).NumDataNodes(0).Build();
     tool = new DFSHAAdmin();
     tool.SetConf(conf);
     tool.SetErrOut(new TextWriter(errOutBytes));
     cluster.WaitActive();
     nn1Port = cluster.GetNameNodePort(0);
 }
        public static Org.Apache.Hadoop.Hdfs.Tools.DFSZKFailoverController Create(Configuration
                                                                                  conf)
        {
            Configuration localNNConf = DFSHAAdmin.AddSecurityConfiguration(conf);
            string        nsId        = DFSUtil.GetNamenodeNameServiceId(conf);

            if (!HAUtil.IsHAEnabled(localNNConf, nsId))
            {
                throw new HadoopIllegalArgumentException("HA is not enabled for this namenode.");
            }
            string nnId = HAUtil.GetNameNodeId(localNNConf, nsId);

            if (nnId == null)
            {
                string msg = "Could not get the namenode ID of this node. " + "You may run zkfc on the node other than namenode.";
                throw new HadoopIllegalArgumentException(msg);
            }
            NameNode.InitializeGenericKeys(localNNConf, nsId, nnId);
            DFSUtil.SetGenericConf(localNNConf, nsId, nnId, ZkfcConfKeys);
            NNHAServiceTarget localTarget = new NNHAServiceTarget(localNNConf, nsId, nnId);

            return(new Org.Apache.Hadoop.Hdfs.Tools.DFSZKFailoverController(localNNConf, localTarget
                                                                            ));
        }