Esempio n. 1
0
 /// <exception cref="System.IO.IOException"/>
 private MiniJournalCluster(MiniJournalCluster.Builder b)
 {
     Log.Info("Starting MiniJournalCluster with " + b.numJournalNodes + " journal nodes"
              );
     if (b.baseDir != null)
     {
         this.baseDir = new FilePath(b.baseDir);
     }
     else
     {
         this.baseDir = new FilePath(MiniDFSCluster.GetBaseDirectory());
     }
     nodes = new MiniJournalCluster.JNInfo[b.numJournalNodes];
     for (int i = 0; i < b.numJournalNodes; i++)
     {
         if (b.format)
         {
             FilePath dir = GetStorageDir(i);
             Log.Debug("Fully deleting JN directory " + dir);
             FileUtil.FullyDelete(dir);
         }
         JournalNode jn = new JournalNode();
         jn.SetConf(CreateConfForNode(b, i));
         jn.Start();
         nodes[i] = new MiniJournalCluster.JNInfo(jn);
     }
 }
Esempio n. 2
0
        private Configuration CreateConfForNode(MiniJournalCluster.Builder b, int idx)
        {
            Configuration conf   = new Configuration(b.conf);
            FilePath      logDir = GetStorageDir(idx);

            conf.Set(DFSConfigKeys.DfsJournalnodeEditsDirKey, logDir.ToString());
            conf.Set(DFSConfigKeys.DfsJournalnodeRpcAddressKey, "localhost:0");
            conf.Set(DFSConfigKeys.DfsJournalnodeHttpAddressKey, "localhost:0");
            return(conf);
        }
        public virtual void TestStartStop()
        {
            Configuration      conf = new Configuration();
            MiniJournalCluster c    = new MiniJournalCluster.Builder(conf).Build();

            try
            {
                URI      uri   = c.GetQuorumJournalURI("myjournal");
                string[] addrs = uri.GetAuthority().Split(";");
                NUnit.Framework.Assert.AreEqual(3, addrs.Length);
                JournalNode node = c.GetJournalNode(0);
                string      dir  = node.GetConf().Get(DFSConfigKeys.DfsJournalnodeEditsDirKey);
                NUnit.Framework.Assert.AreEqual(new FilePath(MiniDFSCluster.GetBaseDirectory() +
                                                             "journalnode-0").GetAbsolutePath(), dir);
            }
            finally
            {
                c.Shutdown();
            }
        }