Exemplo 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);
     }
 }
Exemplo n.º 2
0
        /// <exception cref="System.Exception"/>
        /// <exception cref="System.IO.IOException"/>
        public virtual void RestartJournalNode(int i)
        {
            MiniJournalCluster.JNInfo info = nodes[i];
            JournalNode   jn   = info.node;
            Configuration conf = new Configuration(jn.GetConf());

            if (jn.IsStarted())
            {
                jn.StopAndJoin(0);
            }
            conf.Set(DFSConfigKeys.DfsJournalnodeRpcAddressKey, NetUtils.GetHostPortString(info
                                                                                           .ipcAddr));
            string uri = info.httpServerURI;

            if (uri.StartsWith("http://"))
            {
                conf.Set(DFSConfigKeys.DfsJournalnodeHttpAddressKey, Sharpen.Runtime.Substring(uri
                                                                                               , ("http://".Length)));
            }
            else
            {
                if (info.httpServerURI.StartsWith("https://"))
                {
                    conf.Set(DFSConfigKeys.DfsJournalnodeHttpsAddressKey, Sharpen.Runtime.Substring(uri
                                                                                                    , ("https://".Length)));
                }
            }
            JournalNode newJN = new JournalNode();

            newJN.SetConf(conf);
            newJN.Start();
            info.node = newJN;
        }