コード例 #1
0
 /// <exception cref="System.Exception"/>
 protected override void ServiceStart()
 {
     lock (this)
     {
         try
         {
             if (!this.GetConfig().GetBoolean(JHAdminConfig.MrHistoryMiniclusterFixedPorts, JHAdminConfig
                                              .DefaultMrHistoryMiniclusterFixedPorts))
             {
                 string hostname = MiniYARNCluster.GetHostname();
                 // pick free random ports.
                 this.GetConfig().Set(JHAdminConfig.MrHistoryAddress, hostname + ":0");
                 MRWebAppUtil.SetJHSWebappURLWithoutScheme(this.GetConfig(), hostname + ":0");
                 this.GetConfig().Set(JHAdminConfig.JhsAdminAddress, hostname + ":0");
             }
             this._enclosing.historyServer = new JobHistoryServer();
             this._enclosing.historyServer.Init(this.GetConfig());
             new _Thread_212(this).Start();
             while (!this.jhsStarted)
             {
                 MiniMRYarnCluster.Log.Info("Waiting for HistoryServer to start...");
                 Sharpen.Thread.Sleep(1500);
             }
             //TODO Add a timeout. State.STOPPED check ?
             if (this._enclosing.historyServer.GetServiceState() != Service.STATE.Started)
             {
                 throw new IOException("HistoryServer failed to start");
             }
             base.ServiceStart();
         }
         catch (Exception t)
         {
             throw new YarnRuntimeException(t);
         }
         //need to do this because historyServer.init creates a new Configuration
         this.GetConfig().Set(JHAdminConfig.MrHistoryAddress, this._enclosing.historyServer
                              .GetConfig().Get(JHAdminConfig.MrHistoryAddress));
         MRWebAppUtil.SetJHSWebappURLWithoutScheme(this.GetConfig(), MRWebAppUtil.GetJHSWebappURLWithoutScheme
                                                       (this._enclosing.historyServer.GetConfig()));
         MiniMRYarnCluster.Log.Info("MiniMRYARN ResourceManager address: " + this.GetConfig
                                        ().Get(YarnConfiguration.RmAddress));
         MiniMRYarnCluster.Log.Info("MiniMRYARN ResourceManager web address: " + WebAppUtils
                                    .GetRMWebAppURLWithoutScheme(this.GetConfig()));
         MiniMRYarnCluster.Log.Info("MiniMRYARN HistoryServer address: " + this.GetConfig(
                                        ).Get(JHAdminConfig.MrHistoryAddress));
         MiniMRYarnCluster.Log.Info("MiniMRYARN HistoryServer web address: " + MiniMRYarnCluster
                                    .GetResolvedMRHistoryWebAppURLWithoutScheme(this.GetConfig(), MRWebAppUtil.GetJHSHttpPolicy
                                                                                    () == HttpConfig.Policy.HttpsOnly));
     }
 }
コード例 #2
0
        protected internal virtual void InitializeWebApp(Configuration conf)
        {
            webApp = new HsWebApp(history);
            IPEndPoint bindAddress = MRWebAppUtil.GetJHSWebBindAddress(conf);

            // NOTE: there should be a .at(InetSocketAddress)
            WebApps.$for <Org.Apache.Hadoop.Mapreduce.V2.HS.HistoryClientService>("jobhistory"
                                                                                  , this, "ws").With(conf).WithHttpSpnegoKeytabKey(JHAdminConfig.MrWebappSpnegoKeytabFileKey
                                                                                                                                   ).WithHttpSpnegoPrincipalKey(JHAdminConfig.MrWebappSpnegoUserNameKey).At(NetUtils
                                                                                                                                                                                                            .GetHostPortString(bindAddress)).Start(webApp);
            string connectHost = MRWebAppUtil.GetJHSWebappURLWithoutScheme(conf).Split(":")[0
                                 ];

            MRWebAppUtil.SetJHSWebappURLWithoutScheme(conf, connectHost + ":" + webApp.GetListenerAddress
                                                          ().Port);
        }