Beispiel #1
0
 /// <summary>Stop the daemon with the given status code</summary>
 /// <param name="rc">
 /// the status code with which to exit (non-zero
 /// should indicate an error)
 /// </param>
 public virtual void Stop(int rc)
 {
     this.resultCode = rc;
     if (rpcServer != null)
     {
         rpcServer.Stop();
     }
     if (httpServer != null)
     {
         try
         {
             httpServer.Stop();
         }
         catch (IOException ioe)
         {
             Log.Warn("Unable to stop HTTP server for " + this, ioe);
         }
     }
     foreach (Journal j in journalsById.Values)
     {
         IOUtils.Cleanup(Log, j);
     }
     if (journalNodeInfoBeanName != null)
     {
         MBeans.Unregister(journalNodeInfoBeanName);
         journalNodeInfoBeanName = null;
     }
 }
Beispiel #2
0
 private MetricsProxy(string @namespace)
 {
     // One singleton per namespace
     // Weakref for delegate, so we don't retain it forever if it can be GC'd
     // Keep track of how many objects we registered
     MBeans.Register(@namespace, "FairCallQueue", this);
 }
Beispiel #3
0
 private void InitSystemMBean()
 {
     Preconditions.CheckNotNull(prefix, "prefix should not be null here!");
     if (mbeanName == null)
     {
         mbeanName = MBeans.Register(prefix, MsControlName, this);
     }
 }
Beispiel #4
0
 internal virtual void StopMBeans()
 {
     lock (this)
     {
         if (mbeanName != null)
         {
             MBeans.Unregister(mbeanName);
             mbeanName = null;
         }
     }
 }
Beispiel #5
0
 /// <summary>Shut down this instance of the datanode.</summary>
 /// <remarks>
 /// Shut down this instance of the datanode.
 /// Returns only after shutdown is complete.
 /// </remarks>
 public virtual void Shutdown()
 {
     shouldRun = false;
     if (checkpointThread != null)
     {
         checkpointThread.Interrupt();
         try
         {
             checkpointThread.Join(10000);
         }
         catch (Exception)
         {
             Log.Info("Interrupted waiting to join on checkpointer thread");
             Sharpen.Thread.CurrentThread().Interrupt();
         }
     }
     // maintain status
     try
     {
         if (infoServer != null)
         {
             infoServer.Stop();
             infoServer = null;
         }
     }
     catch (Exception e)
     {
         Log.Warn("Exception shutting down SecondaryNameNode", e);
     }
     if (nameNodeStatusBeanName != null)
     {
         MBeans.Unregister(nameNodeStatusBeanName);
         nameNodeStatusBeanName = null;
     }
     try
     {
         if (checkpointImage != null)
         {
             checkpointImage.Close();
             checkpointImage = null;
         }
     }
     catch (IOException e)
     {
         Log.Warn("Exception while closing CheckpointStorage", e);
     }
     if (namesystem != null)
     {
         namesystem.Shutdown();
         namesystem = null;
     }
 }
Beispiel #6
0
 internal virtual void StartMBeans()
 {
     lock (this)
     {
         if (mbeanName != null)
         {
             Log.Warn("MBean " + name + " already initialized!");
             Log.Debug("Stacktrace: ", new Exception());
             return;
         }
         mbeanName = MBeans.Register(prefix, name, this);
         Log.Debug("MBean for source " + name + " registered.");
     }
 }
Beispiel #7
0
        /// <summary>Constructor for RMNMInfo registers the bean with JMX.</summary>
        /// <param name="rmc">resource manager's context object</param>
        /// <param name="sched">resource manager's scheduler object</param>
        public RMNMInfo(RMContext rmc, ResourceScheduler sched)
        {
            this.rmContext = rmc;
            this.scheduler = sched;
            StandardMBean bean;

            try
            {
                bean = new StandardMBean(this, typeof(RMNMInfoBeans));
                MBeans.Register("ResourceManager", "RMNMInfo", bean);
            }
            catch (NotCompliantMBeanException e)
            {
                Log.Warn("Error registering RMNMInfo MBean", e);
            }
            Log.Info("Registered RMNMInfo MBean");
        }
Beispiel #8
0
 public override bool Shutdown()
 {
     lock (this)
     {
         Log.Debug("refCount=" + refCount);
         if (refCount <= 0)
         {
             Log.Debug("Redundant shutdown", new Exception());
             return(true);
         }
         // already shutdown
         if (--refCount > 0)
         {
             return(false);
         }
         if (monitoring)
         {
             try
             {
                 Stop();
             }
             catch (Exception e)
             {
                 Log.Warn("Error stopping the metrics system", e);
             }
         }
         allSources.Clear();
         allSinks.Clear();
         callbacks.Clear();
         namedCallbacks.Clear();
         if (mbeanName != null)
         {
             MBeans.Unregister(mbeanName);
             mbeanName = null;
         }
         Log.Info(prefix + " metrics system shutdown complete.");
         return(true);
     }
 }
Beispiel #9
0
 public virtual void Shutdown()
 {
     MBeans.Unregister(mxBeanName);
     mxBeanName = null;
 }
Beispiel #10
0
 public virtual void RegisterMXBean()
 {
     mxBeanName = MBeans.Register("NameNode", "SnapshotInfo", this);
 }
 private MetricsProxy(string @namespace)
 {
     // One singleton per namespace
     // Weakref for delegate, so we don't retain it forever if it can be GC'd
     MBeans.Register(@namespace, "DecayRpcScheduler", this);
 }
Beispiel #12
0
 /// <summary>Register JournalNodeMXBean</summary>
 private void RegisterJNMXBean()
 {
     journalNodeInfoBeanName = MBeans.Register("JournalNode", "JournalNodeInfo", this);
 }
Beispiel #13
0
        /// <summary>Initialize SecondaryNameNode.</summary>
        /// <exception cref="System.IO.IOException"/>
        private void Initialize(Configuration conf, SecondaryNameNode.CommandLineOpts commandLineOpts
                                )
        {
            IPEndPoint infoSocAddr     = GetHttpAddress(conf);
            string     infoBindAddress = infoSocAddr.GetHostName();

            UserGroupInformation.SetConfiguration(conf);
            if (UserGroupInformation.IsSecurityEnabled())
            {
                SecurityUtil.Login(conf, DFSConfigKeys.DfsSecondaryNamenodeKeytabFileKey, DFSConfigKeys
                                   .DfsSecondaryNamenodeKerberosPrincipalKey, infoBindAddress);
            }
            // initiate Java VM metrics
            DefaultMetricsSystem.Initialize("SecondaryNameNode");
            JvmMetrics.Create("SecondaryNameNode", conf.Get(DFSConfigKeys.DfsMetricsSessionIdKey
                                                            ), DefaultMetricsSystem.Instance());
            // Create connection to the namenode.
            shouldRun     = true;
            nameNodeAddr  = NameNode.GetServiceAddress(conf, true);
            this.conf     = conf;
            this.namenode = NameNodeProxies.CreateNonHAProxy <NamenodeProtocol>(conf, nameNodeAddr
                                                                                , UserGroupInformation.GetCurrentUser(), true).GetProxy();
            // initialize checkpoint directories
            fsName              = GetInfoServer();
            checkpointDirs      = FSImage.GetCheckpointDirs(conf, "/tmp/hadoop/dfs/namesecondary");
            checkpointEditsDirs = FSImage.GetCheckpointEditsDirs(conf, "/tmp/hadoop/dfs/namesecondary"
                                                                 );
            checkpointImage = new SecondaryNameNode.CheckpointStorage(conf, checkpointDirs, checkpointEditsDirs
                                                                      );
            checkpointImage.RecoverCreate(commandLineOpts.ShouldFormat());
            checkpointImage.DeleteTempEdits();
            namesystem = new FSNamesystem(conf, checkpointImage, true);
            // Disable quota checks
            namesystem.dir.DisableQuotaChecks();
            // Initialize other scheduling parameters from the configuration
            checkpointConf = new CheckpointConf(conf);
            IPEndPoint httpAddr        = infoSocAddr;
            string     httpsAddrString = conf.GetTrimmed(DFSConfigKeys.DfsNamenodeSecondaryHttpsAddressKey
                                                         , DFSConfigKeys.DfsNamenodeSecondaryHttpsAddressDefault);
            IPEndPoint httpsAddr = NetUtils.CreateSocketAddr(httpsAddrString);

            HttpServer2.Builder builder = DFSUtil.HttpServerTemplateForNNAndJN(conf, httpAddr
                                                                               , httpsAddr, "secondary", DFSConfigKeys.DfsSecondaryNamenodeKerberosInternalSpnegoPrincipalKey
                                                                               , DFSConfigKeys.DfsSecondaryNamenodeKeytabFileKey);
            nameNodeStatusBeanName = MBeans.Register("SecondaryNameNode", "SecondaryNameNodeInfo"
                                                     , this);
            infoServer = builder.Build();
            infoServer.SetAttribute("secondary.name.node", this);
            infoServer.SetAttribute("name.system.image", checkpointImage);
            infoServer.SetAttribute(JspHelper.CurrentConf, conf);
            infoServer.AddInternalServlet("imagetransfer", ImageServlet.PathSpec, typeof(ImageServlet
                                                                                         ), true);
            infoServer.Start();
            Log.Info("Web server init done");
            HttpConfig.Policy policy = DFSUtil.GetHttpPolicy(conf);
            int connIdx = 0;

            if (policy.IsHttpEnabled())
            {
                IPEndPoint httpAddress = infoServer.GetConnectorAddress(connIdx++);
                conf.Set(DFSConfigKeys.DfsNamenodeSecondaryHttpAddressKey, NetUtils.GetHostPortString
                             (httpAddress));
            }
            if (policy.IsHttpsEnabled())
            {
                IPEndPoint httpsAddress = infoServer.GetConnectorAddress(connIdx);
                conf.Set(DFSConfigKeys.DfsNamenodeSecondaryHttpsAddressKey, NetUtils.GetHostPortString
                             (httpsAddress));
            }
            legacyOivImageDir = conf.Get(DFSConfigKeys.DfsNamenodeLegacyOivImageDirKey);
            Log.Info("Checkpoint Period   :" + checkpointConf.GetPeriod() + " secs " + "(" +
                     checkpointConf.GetPeriod() / 60 + " min)");
            Log.Info("Log Size Trigger    :" + checkpointConf.GetTxnCount() + " txns");
        }