if (policy.isHttpEnabled()) { httpChannel = ServerSocketChannel.open(); InetSocketAddress infoSocAddr = DataNode.getInfoAddr(conf);
HttpConfig.Policy policy = DFSUtil.getHttpPolicy(conf); if (policy.isHttpEnabled()) { this.httpServer = new ServerBootstrap().group(bossGroup, workerGroup) .childHandler(new ChannelInitializer<SocketChannel>() {
if (policy.isHttpEnabled()) { if (httpAddr.getPort() == 0) { builder.setFindPort(true);
if (policy.isHttpEnabled()) { InetSocketAddress httpAddress = infoServer.getConnectorAddress(connIdx++); conf.set(DFSConfigKeys.DFS_NAMENODE_SECONDARY_HTTP_ADDRESS_KEY,
HttpConfig.Policy policy = DFSUtil.getHttpPolicy(conf); if (policy.isHttpEnabled()) { this.httpServer = new ServerBootstrap().group(bossGroup, workerGroup) .childHandler(new ChannelInitializer<SocketChannel>() {
conf.getString(WebConfigKey.HAS_HTTPS_BIND_HOST_KEY); InetSocketAddress httpAddr = null; if (policy.isHttpEnabled()) { final String httpAddrString = conf.getString( WebConfigKey.HAS_HTTP_ADDRESS_KEY, if (policy.isHttpEnabled()) { httpAddress = httpServer.getConnectorAddress(connIdx++); if (httpAddress != null) {
if (policy.isHttpEnabled()) { httpAddress = httpServer.getConnectorAddress(connIdx++); conf.set(DFSConfigKeys.DFS_NAMENODE_HTTP_ADDRESS_KEY,
conf.getString(WebConfigKey.HAS_HTTPS_BIND_HOST_KEY); InetSocketAddress httpAddr = null; if (policy.isHttpEnabled()) { final String httpAddrString = conf.getString( WebConfigKey.HAS_HTTP_ADDRESS_KEY, if (policy.isHttpEnabled()) { httpAddress = httpServer.getConnectorAddress(connIdx++); if (httpAddress != null) {
if (policy.isHttpEnabled()) { httpChannel = ServerSocketChannel.open(); InetSocketAddress infoSocAddr = DataNode.getInfoAddr(conf);
if (policy.isHttpEnabled()) { httpChannel = ServerSocketChannel.open(); InetSocketAddress infoSocAddr = DataNode.getInfoAddr(conf);
if (policy.isHttpEnabled()) { httpAddress = httpServer.getConnectorAddress(connIdx++); conf.set(DFSConfigKeys.DFS_NAMENODE_HTTP_ADDRESS_KEY,
if (policy.isHttpEnabled()) { if (httpAddr != null && httpAddr.getPort() == 0) { builder.setFindPort(true);
if (policy.isHttpEnabled()) { if (httpAddr.getPort() == 0) { builder.setFindPort(true);
if (policy.isHttpEnabled()) { if (httpAddr.getPort() == 0) { builder.setFindPort(true);
if (policy.isHttpEnabled()) { if (httpAddr != null && httpAddr.getPort() == 0) { builder.setFindPort(true);
@Test public void testHttpPolicy() throws Exception { conf.set(DFSConfigKeys.DFS_HTTP_POLICY_KEY, policy.name()); conf.set(DFSConfigKeys.DFS_NAMENODE_HTTPS_ADDRESS_KEY, "localhost:0"); InetSocketAddress addr = InetSocketAddress.createUnresolved("localhost", 0); NameNodeHttpServer server = null; try { server = new NameNodeHttpServer(conf, null, addr); server.start(); Assert.assertTrue(implies(policy.isHttpEnabled(), canAccess("http", server.getHttpAddress()))); Assert.assertTrue(implies(!policy.isHttpEnabled(), server.getHttpAddress() == null)); Assert.assertTrue(implies(policy.isHttpsEnabled(), canAccess("https", server.getHttpsAddress()))); Assert.assertTrue(implies(!policy.isHttpsEnabled(), server.getHttpsAddress() == null)); } finally { if (server != null) { server.stop(); } } }
void start() throws IOException { final InetSocketAddress httpAddr = getHttpAddress(conf); final String httpsAddrString = conf.get( NfsConfigKeys.NFS_HTTPS_ADDRESS_KEY, NfsConfigKeys.NFS_HTTPS_ADDRESS_DEFAULT); InetSocketAddress httpsAddr = NetUtils.createSocketAddr(httpsAddrString); HttpServer2.Builder builder = DFSUtil.httpServerTemplateForNNAndJN(conf, httpAddr, httpsAddr, "nfs3", NfsConfigKeys.DFS_NFS_KERBEROS_PRINCIPAL_KEY, NfsConfigKeys.DFS_NFS_KEYTAB_FILE_KEY); this.httpServer = builder.build(); this.httpServer.start(); HttpConfig.Policy policy = DFSUtil.getHttpPolicy(conf); int connIdx = 0; if (policy.isHttpEnabled()) { infoPort = httpServer.getConnectorAddress(connIdx++).getPort(); } if (policy.isHttpsEnabled()) { infoSecurePort = httpServer.getConnectorAddress(connIdx).getPort(); } }
if (policy.isHttpEnabled()) { httpAddress = httpServer.getConnectorAddress(connIdx++); conf.set(DFSConfigKeys.DFS_NAMENODE_HTTP_ADDRESS_KEY,
if (policy.isHttpEnabled()) { httpAddress = httpServer.getConnectorAddress(connIdx++); conf.set(DFSConfigKeys.DFS_JOURNALNODE_HTTP_ADDRESS_KEY,
if (policy.isHttpEnabled()) { InetSocketAddress httpAddress = infoServer.getConnectorAddress(connIdx++);