예제 #1
0
 /// <exception cref="System.Exception"/>
 protected override void ServiceStart()
 {
     SCMWebServer.SCMWebApp scmWebApp = new SCMWebServer.SCMWebApp(this, scm);
     this.webApp = WebApps.$for("sharedcache").At(bindAddress).Start(scmWebApp);
     Log.Info("Instantiated " + typeof(SCMWebServer.SCMWebApp).FullName + " at " + bindAddress
              );
 }
예제 #2
0
        /// <exception cref="System.Exception"/>
        protected override void ServiceStart()
        {
            Configuration conf    = GetConfig();
            YarnRPC       rpc     = YarnRPC.Create(conf);
            IPEndPoint    address = new IPEndPoint(0);

            server = rpc.GetServer(typeof(MRClientProtocol), protocolHandler, address, conf,
                                   appContext.GetClientToAMTokenSecretManager(), conf.GetInt(MRJobConfig.MrAmJobClientThreadCount
                                                                                             , MRJobConfig.DefaultMrAmJobClientThreadCount), MRJobConfig.MrAmJobClientPortRange
                                   );
            // Enable service authorization?
            if (conf.GetBoolean(CommonConfigurationKeysPublic.HadoopSecurityAuthorization, false
                                ))
            {
                RefreshServiceAcls(conf, new MRAMPolicyProvider());
            }
            server.Start();
            this.bindAddress = NetUtils.CreateSocketAddrForHost(appContext.GetNMHostname(), server
                                                                .GetListenerAddress().Port);
            Log.Info("Instantiated MRClientService at " + this.bindAddress);
            try
            {
                // Explicitly disabling SSL for map reduce task as we can't allow MR users
                // to gain access to keystore file for opening SSL listener. We can trust
                // RM/NM to issue SSL certificates but definitely not MR-AM as it is
                // running in user-land.
                webApp = WebApps.$for <AppContext>("mapreduce", appContext, "ws").WithHttpPolicy(conf
                                                                                                 , HttpConfig.Policy.HttpOnly).Start(new AMWebApp());
            }
            catch (Exception e)
            {
                Log.Error("Webapps failed to start. Ignoring for now:", e);
            }
            base.ServiceStart();
        }
예제 #3
0
        /// <exception cref="System.Exception"/>
        protected override void ServiceStart()
        {
            string bindAddress = WebAppUtils.GetWebAppBindURL(GetConfig(), YarnConfiguration.
                                                              NmBindHost, WebAppUtils.GetNMWebAppURLWithoutScheme(GetConfig()));
            bool enableCors = GetConfig().GetBoolean(YarnConfiguration.NmWebappEnableCorsFilter
                                                     , YarnConfiguration.DefaultNmWebappEnableCorsFilter);

            if (enableCors)
            {
                GetConfig().SetBoolean(HttpCrossOriginFilterInitializer.Prefix + HttpCrossOriginFilterInitializer
                                       .EnabledSuffix, true);
            }
            Log.Info("Instantiating NMWebApp at " + bindAddress);
            try
            {
                this.webApp = WebApps.$for <Context>("node", this.nmContext, "ws").At(bindAddress)
                              .With(GetConfig()).WithHttpSpnegoPrincipalKey(YarnConfiguration.NmWebappSpnegoUserNameKey
                                                                            ).WithHttpSpnegoKeytabKey(YarnConfiguration.NmWebappSpnegoKeytabFileKey).Start(this
                                                                                                                                                           .nmWebApp);
                this.port = this.webApp.HttpServer().GetConnectorAddress(0).Port;
            }
            catch (Exception e)
            {
                string msg = "NMWebapps failed to start.";
                Log.Error(msg, e);
                throw new YarnRuntimeException(msg, e);
            }
            base.ServiceStart();
        }
예제 #4
0
 /// <exception cref="System.Exception"/>
 public static void Main(string[] args)
 {
     // For manual testing
     WebApps.$for("yarn", new TestRMWebApp()).At(8888).InDevMode().Start(new RMWebApp(
                                                                             MockRm(2500, 8, 8, 8 * GiB))).JoinThread();
     WebApps.$for("yarn", new TestRMWebApp()).At(8888).InDevMode().Start(new RMWebApp(
                                                                             MockFifoRm(10, 1, 4, 8 * GiB))).JoinThread();
 }
예제 #5
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);
        }
예제 #6
0
 public static void Main(string[] args)
 {
     WebApps.$for <AppContext>("yarn", new MockAppContext(0, 8, 88, 4)).At(58888).InDevMode
         ().Start(new AMWebApp()).JoinThread();
 }
예제 #7
0
 public static void Main(string[] args)
 {
     WebApps.$for(new HelloWorld()).At(8888).InDevMode().Start().JoinThread();
 }
예제 #8
0
 public static void Main(string[] args)
 {
     WebApps.$for("test").At(8888).InDevMode().Start().JoinThread();
 }
        private void StartWebApp()
        {
            Configuration conf = GetConfig();

            TimelineAuthenticationFilter.SetTimelineDelegationTokenSecretManager(secretManagerService
                                                                                 .GetTimelineDelegationTokenSecretManager());
            // Always load pseudo authentication filter to parse "user.name" in an URL
            // to identify a HTTP request's user in insecure mode.
            // When Kerberos authentication type is set (i.e., secure mode is turned on),
            // the customized filter will be loaded by the timeline server to do Kerberos
            // + DT authentication.
            string initializers         = conf.Get("hadoop.http.filter.initializers");
            bool   modifiedInitializers = false;

            initializers = initializers == null || initializers.Length == 0 ? string.Empty :
                           initializers;
            if (!initializers.Contains(typeof(CrossOriginFilterInitializer).FullName))
            {
                if (conf.GetBoolean(YarnConfiguration.TimelineServiceHttpCrossOriginEnabled, YarnConfiguration
                                    .TimelineServiceHttpCrossOriginEnabledDefault))
                {
                    if (initializers.Contains(typeof(HttpCrossOriginFilterInitializer).FullName))
                    {
                        initializers = initializers.ReplaceAll(typeof(HttpCrossOriginFilterInitializer).FullName
                                                               , typeof(CrossOriginFilterInitializer).FullName);
                    }
                    else
                    {
                        if (initializers.Length != 0)
                        {
                            initializers += ",";
                        }
                        initializers += typeof(CrossOriginFilterInitializer).FullName;
                    }
                    modifiedInitializers = true;
                }
            }
            if (!initializers.Contains(typeof(TimelineAuthenticationFilterInitializer).FullName
                                       ))
            {
                if (initializers.Length != 0)
                {
                    initializers += ",";
                }
                initializers        += typeof(TimelineAuthenticationFilterInitializer).FullName;
                modifiedInitializers = true;
            }
            string[]       parts  = initializers.Split(",");
            AList <string> target = new AList <string>();

            foreach (string filterInitializer in parts)
            {
                filterInitializer = filterInitializer.Trim();
                if (filterInitializer.Equals(typeof(AuthenticationFilterInitializer).FullName))
                {
                    modifiedInitializers = true;
                    continue;
                }
                target.AddItem(filterInitializer);
            }
            string actualInitializers = StringUtils.Join(target, ",");

            if (modifiedInitializers)
            {
                conf.Set("hadoop.http.filter.initializers", actualInitializers);
            }
            string bindAddress = WebAppUtils.GetWebAppBindURL(conf, YarnConfiguration.TimelineServiceBindHost
                                                              , WebAppUtils.GetAHSWebAppURLWithoutScheme(conf));

            try
            {
                AHSWebApp ahsWebApp = new AHSWebApp(timelineDataManager, ahsClientService);
                webApp = WebApps.$for <ApplicationHistoryClientService>("applicationhistory", ahsClientService
                                                                        , "ws").With(conf).WithAttribute(YarnConfiguration.TimelineServiceWebappAddress,
                                                                                                         conf.Get(YarnConfiguration.TimelineServiceWebappAddress)).At(bindAddress).Build(
                    ahsWebApp);
                HttpServer2   httpServer    = webApp.HttpServer();
                string[]      names         = conf.GetTrimmedStrings(YarnConfiguration.TimelineServiceUiNames);
                WebAppContext webAppContext = httpServer.GetWebAppContext();
                foreach (string name in names)
                {
                    string webPath = conf.Get(YarnConfiguration.TimelineServiceUiWebPathPrefix + name
                                              );
                    string onDiskPath = conf.Get(YarnConfiguration.TimelineServiceUiOnDiskPathPrefix
                                                 + name);
                    WebAppContext uiWebAppContext = new WebAppContext();
                    uiWebAppContext.SetContextPath(webPath);
                    uiWebAppContext.SetWar(onDiskPath);
                    string[]       AllUrls       = new string[] { "/*" };
                    FilterHolder[] filterHolders = webAppContext.GetServletHandler().GetFilters();
                    foreach (FilterHolder filterHolder in filterHolders)
                    {
                        if (!"guice".Equals(filterHolder.GetName()))
                        {
                            HttpServer2.DefineFilter(uiWebAppContext, filterHolder.GetName(), filterHolder.GetClassName
                                                         (), filterHolder.GetInitParameters(), AllUrls);
                        }
                    }
                    Log.Info("Hosting " + name + " from " + onDiskPath + " at " + webPath);
                    httpServer.AddContext(uiWebAppContext, true);
                }
                httpServer.Start();
                conf.UpdateConnectAddr(YarnConfiguration.TimelineServiceBindHost, YarnConfiguration
                                       .TimelineServiceWebappAddress, YarnConfiguration.DefaultTimelineServiceWebappAddress
                                       , this.GetListenerAddress());
                Log.Info("Instantiating AHSWebApp at " + GetPort());
            }
            catch (Exception e)
            {
                string msg = "AHSWebApp failed to start.";
                Log.Error(msg, e);
                throw new YarnRuntimeException(msg, e);
            }
        }