HDFS-9049. Make Datanode Netty reverse proxy port to be configurable. Contributed by Vinayakumar B.
This commit is contained in:
parent
268ab4e027
commit
09efdfe9e1
|
@ -650,6 +650,8 @@ public class DFSConfigKeys extends CommonConfigurationKeys {
|
|||
public static final String DFS_DATANODE_HTTP_ADDRESS_KEY = "dfs.datanode.http.address";
|
||||
public static final int DFS_DATANODE_HTTP_DEFAULT_PORT = 9864;
|
||||
public static final String DFS_DATANODE_HTTP_ADDRESS_DEFAULT = "0.0.0.0:" + DFS_DATANODE_HTTP_DEFAULT_PORT;
|
||||
public static final String DFS_DATANODE_HTTP_INTERNAL_PROXY_PORT =
|
||||
"dfs.datanode.http.internal-proxy.port";
|
||||
public static final String DFS_DATANODE_MAX_RECEIVER_THREADS_KEY =
|
||||
HdfsClientConfigKeys.DeprecatedKeys.DFS_DATANODE_MAX_RECEIVER_THREADS_KEY;
|
||||
public static final int DFS_DATANODE_MAX_RECEIVER_THREADS_DEFAULT = 4096;
|
||||
|
|
|
@ -72,6 +72,7 @@ import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_ADMIN;
|
|||
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_HTTPS_ADDRESS_DEFAULT;
|
||||
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_HTTPS_ADDRESS_KEY;
|
||||
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_HTTP_ADDRESS_KEY;
|
||||
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_HTTP_INTERNAL_PROXY_PORT;
|
||||
|
||||
public class DatanodeHttpServer implements Closeable {
|
||||
private final HttpServer2 infoServer;
|
||||
|
@ -97,12 +98,14 @@ public class DatanodeHttpServer implements Closeable {
|
|||
|
||||
Configuration confForInfoServer = new Configuration(conf);
|
||||
confForInfoServer.setInt(HttpServer2.HTTP_MAX_THREADS_KEY, 10);
|
||||
int proxyPort =
|
||||
confForInfoServer.getInt(DFS_DATANODE_HTTP_INTERNAL_PROXY_PORT, 0);
|
||||
HttpServer2.Builder builder = new HttpServer2.Builder()
|
||||
.setName("datanode")
|
||||
.setConf(confForInfoServer)
|
||||
.setACL(new AccessControlList(conf.get(DFS_ADMIN, " ")))
|
||||
.hostName(getHostnameForSpnegoPrincipal(confForInfoServer))
|
||||
.addEndpoint(URI.create("http://localhost:0"))
|
||||
.addEndpoint(URI.create("http://localhost:" + proxyPort))
|
||||
.setFindPort(true);
|
||||
|
||||
final boolean xFrameEnabled = conf.getBoolean(
|
||||
|
|
|
@ -145,6 +145,15 @@
|
|||
</description>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>dfs.datanode.http.internal-proxy.port</name>
|
||||
<value>0</value>
|
||||
<description>
|
||||
The datanode's internal web proxy port.
|
||||
By default it selects a random port available in runtime.
|
||||
</description>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>dfs.datanode.handler.count</name>
|
||||
<value>10</value>
|
||||
|
|
Loading…
Reference in New Issue