Exemplo n.º 1
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;
        }
Exemplo n.º 2
0
        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();
            }
        }