HttpServer2.Builder builder = new HttpServer2.Builder() .setName("datanode") .setConf(confForInfoServer) .setACL(new AccessControlList(conf.get(DFS_ADMIN, " "))) .hostName(getHostnameForSpnegoPrincipal(confForInfoServer))
.setConf(conf).setACL(new AccessControlList(conf.get(DFS_ADMIN, " "))) .setSecurityEnabled(UserGroupInformation.isSecurityEnabled()) .setUsernameConfKey(spnegoUserNameKey)
/** * Return a HttpServer.Builder that the journalnode / namenode / secondary * namenode can use to initialize their HTTP / HTTPS server. * * @param conf configuration object * @param httpAddr HTTP address * @param httpsAddr HTTPS address * @param name Name of the server * @throws IOException from Builder * @return builder object */ public static HttpServer2.Builder httpServerTemplateForRM(Configuration conf, final InetSocketAddress httpAddr, final InetSocketAddress httpsAddr, String name) throws IOException { HttpServer2.Builder builder = new HttpServer2.Builder().setName(name) .setConf(conf).setSecurityEnabled(false); if (httpAddr.getPort() == 0) { builder.setFindPort(true); } URI uri = URI.create("http://" + NetUtils.getHostPortString(httpAddr)); builder.addEndpoint(uri); LOG.info("Starting Web-server for " + name + " at: " + uri); return builder; }
.setName("test") .addEndpoint(new URI("https://localhost")) .setConf(conf) .keyPassword(sslConf.get("ssl.server.keystore.keypassword")) .keyStore(sslConf.get("ssl.server.keystore.location"),
.addEndpoint(new URI("http://localhost")) .addEndpoint(new URI("https://localhost")) .setConf(conf) .keyPassword(sslConf.get("ssl.server.keystore.keypassword")) .keyStore(sslConf.get("ssl.server.keystore.location"),
.addEndpoint(new URI("http://localhost")) .addEndpoint(new URI("https://localhost")) .setConf(conf) .keyPassword(sslConf.get("ssl.server.keystore.keypassword")) .keyStore(sslConf.get("ssl.server.keystore.location"),
.setName("test") .addEndpoint(new URI("https://localhost")) .setConf(conf) .keyPassword(sslConf.get("ssl.server.keystore.keypassword")) .keyStore(sslConf.get("ssl.server.keystore.location"),
@Override protected void serviceStart() throws Exception { try { Configuration conf = getConfig(); HttpServer2.Builder b = new HttpServer2.Builder() .setName("proxy") .addEndpoint( URI.create(WebAppUtils.getHttpSchemePrefix(conf) + bindAddress + ":" + port)).setFindPort(port == 0).setConf(getConfig()) .setACL(acl); if (YarnConfiguration.useHttps(conf)) { WebAppUtils.loadSslConfiguration(b); } proxyServer = b.build(); proxyServer.addServlet(ProxyUriUtils.PROXY_SERVLET_NAME, ProxyUriUtils.PROXY_PATH_SPEC, WebAppProxyServlet.class); proxyServer.setAttribute(FETCHER_ATTRIBUTE, fetcher); proxyServer .setAttribute(IS_SECURITY_ENABLED_ATTRIBUTE, isSecurityEnabled); proxyServer.setAttribute(PROXY_HOST_ATTRIBUTE, proxyHost); proxyServer.start(); } catch (IOException e) { LOG.error("Could not start proxy web server",e); throw e; } super.serviceStart(); }
@Override protected void serviceStart() throws Exception { try { Configuration conf = getConfig(); HttpServer2.Builder b = new HttpServer2.Builder() .setName("proxy") .addEndpoint( URI.create(WebAppUtils.getHttpSchemePrefix(conf) + bindAddress + ":" + port)).setFindPort(port == 0).setConf(getConfig()) .setACL(acl); if (YarnConfiguration.useHttps(conf)) { WebAppUtils.loadSslConfiguration(b); } proxyServer = b.build(); proxyServer.addServlet(ProxyUriUtils.PROXY_SERVLET_NAME, ProxyUriUtils.PROXY_PATH_SPEC, WebAppProxyServlet.class); proxyServer.setAttribute(FETCHER_ATTRIBUTE, fetcher); proxyServer .setAttribute(IS_SECURITY_ENABLED_ATTRIBUTE, isSecurityEnabled); proxyServer.setAttribute(PROXY_HOST_ATTRIBUTE, proxyHost); proxyServer.start(); } catch (IOException e) { LOG.error("Could not start proxy web server",e); throw e; } super.serviceStart(); }
public static void openHBase(String tablename) throws IOException { Configuration conf = HBaseConfiguration.create(); synchronized (HConnection.class) { if (connection == null) connection = HConnectionManager.createConnection(conf); } synchronized (HTableInterface.class) { if (table == null) { table = connection.getTable(tablename); } } /* start http info server */ HttpServer2.Builder builder = new HttpServer2.Builder().setName("recsys").setConf(conf); InetSocketAddress addr = NetUtils.createSocketAddr("0.0.0.0", 8089); builder.addEndpoint(URI.create("http://" + NetUtils.getHostPortString(addr))); infoServer = builder.build(); infoServer.addServlet("monitor", "/monitor", RecsysLogs.class); infoServer.setAttribute("htable", table); infoServer.setAttribute("conf", conf); infoServer.start(); }
@Override protected void serviceStart() throws Exception { try { Configuration conf = getConfig(); HttpServer2.Builder b = new HttpServer2.Builder() .setName("proxy") .addEndpoint( URI.create(WebAppUtils.getHttpSchemePrefix(conf) + bindAddress + ":" + port)).setFindPort(port == 0).setConf(getConfig()) .setACL(acl); if (YarnConfiguration.useHttps(conf)) { WebAppUtils.loadSslConfiguration(b); } proxyServer = b.build(); proxyServer.addServlet(ProxyUriUtils.PROXY_SERVLET_NAME, ProxyUriUtils.PROXY_PATH_SPEC, WebAppProxyServlet.class); proxyServer.setAttribute(FETCHER_ATTRIBUTE, fetcher); proxyServer .setAttribute(IS_SECURITY_ENABLED_ATTRIBUTE, isSecurityEnabled); proxyServer.setAttribute(PROXY_HOST_ATTRIBUTE, proxyHost); proxyServer.start(); } catch (IOException e) { LOG.error("Could not start proxy web server",e); throw e; } super.serviceStart(); }
@Override protected void serviceStart() throws Exception { try { Configuration conf = getConfig(); HttpServer2.Builder b = new HttpServer2.Builder() .setName("proxy") .addEndpoint( URI.create(WebAppUtils.getHttpSchemePrefix(conf) + bindAddress + ":" + port)).setFindPort(port == 0).setConf(getConfig()) .setACL(acl); if (YarnConfiguration.useHttps(conf)) { WebAppUtils.loadSslConfiguration(b); } proxyServer = b.build(); proxyServer.addServlet(ProxyUriUtils.PROXY_SERVLET_NAME, ProxyUriUtils.PROXY_PATH_SPEC, WebAppProxyServlet.class); proxyServer.setAttribute(FETCHER_ATTRIBUTE, fetcher); proxyServer .setAttribute(IS_SECURITY_ENABLED_ATTRIBUTE, isSecurityEnabled); proxyServer.setAttribute(PROXY_HOST_ATTRIBUTE, proxyHost); proxyServer.start(); } catch (IOException e) { LOG.error("Could not start proxy web server",e); throw e; } super.serviceStart(); }
public static void openHBase(String tablename) throws IOException { Configuration conf = HBaseConfiguration.create(); synchronized (HConnection.class) { if (connection == null) connection = HConnectionManager.createConnection(conf); } synchronized (HTableInterface.class) { if (table == null) { table = connection.getTable("recsys_logs"); } } /* start http info server */ HttpServer2.Builder builder = new HttpServer2.Builder().setName("recsys").setConf(conf); InetSocketAddress addr = NetUtils.createSocketAddr("0.0.0.0", 8089); builder.addEndpoint(URI.create("http://" + NetUtils.getHostPortString(addr))); infoServer = builder.build(); infoServer.addServlet("monitor", "/monitor", RecsysLogs.class); infoServer.setAttribute("htable", table); infoServer.setAttribute("conf", conf); infoServer.start(); }
private String startSecureHttpServer() throws Exception { HttpServer2.Builder builder = new HttpServer2.Builder() .setName("test").setConf(rmconf) .addEndpoint(new URI("http://localhost")).setACL( new AccessControlList(rmconf.get(YarnConfiguration.YARN_ADMIN_ACL, YarnConfiguration.DEFAULT_YARN_ADMIN_ACL))); builder.setUsernameConfKey(YarnConfiguration.RM_WEBAPP_SPNEGO_USER_NAME_KEY) .setKeytabConfKey(YarnConfiguration.RM_WEBAPP_SPNEGO_KEYTAB_FILE_KEY) .setSecurityEnabled(UserGroupInformation.isSecurityEnabled()); HttpServer2 server = builder.build(); server.start(); URL baseUrl = new URL( "http://" + NetUtils.getHostPortString(server.getConnectorAddress(0))); return baseUrl.toString(); } }
public static HttpServer2 createServer(String webapp, Configuration conf, AccessControlList adminsAcl) throws IOException { return localServerBuilder(webapp).setFindPort(true).setConf(conf).setACL(adminsAcl).build(); }
public static HttpServer2 createServer(String webapp, Configuration conf, AccessControlList adminsAcl) throws IOException { return localServerBuilder(webapp).setFindPort(true).setConf(conf).setACL(adminsAcl).build(); }
/** * Create an HttpServer instance for the given webapp * @param webapp the webapp to work with * @param conf the configuration to use for the server * @return the server * @throws IOException if it could not be created */ public static HttpServer2 createServer(String webapp, Configuration conf) throws IOException { return localServerBuilder(webapp).setFindPort(true).setConf(conf).build(); }
/** * Create an HttpServer instance for the given webapp * @param webapp the webapp to work with * @param conf the configuration to use for the server * @return the server * @throws IOException if it could not be created */ public static HttpServer2 createServer(String webapp, Configuration conf) throws IOException { return localServerBuilder(webapp).setFindPort(true).setConf(conf).build(); }
/** * Create an HttpServer instance for the given webapp * @param webapp the webapp to work with * @param conf the configuration to use for the server * @param pathSpecs the paths specifications the server will service * @return the server * @throws IOException if it could not be created */ public static HttpServer2 createServer(String webapp, Configuration conf, String[] pathSpecs) throws IOException { return localServerBuilder(webapp).setFindPort(true).setConf(conf).setPathSpec(pathSpecs).build(); }
/** * Create an HttpServer instance for the given webapp * @param webapp the webapp to work with * @param conf the configuration to use for the server * @param pathSpecs the paths specifications the server will service * @return the server * @throws IOException if it could not be created */ public static HttpServer2 createServer(String webapp, Configuration conf, String[] pathSpecs) throws IOException { return localServerBuilder(webapp).setFindPort(true).setConf(conf).setPathSpec(pathSpecs).build(); }