[
https://issues.apache.org/jira/browse/HADOOP-19695?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18021167#comment-18021167
]
ASF GitHub Bot commented on HADOOP-19695:
-----------------------------------------
brumi1024 commented on code in PR #7979:
URL: https://github.com/apache/hadoop/pull/7979#discussion_r2359223851
##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java:
##########
@@ -549,25 +550,50 @@ public HttpServer2 build() throws IOException {
}
for (URI ep : endpoints) {
- final ServerConnector connector;
+ //
+ // To enable dual-stack or IPv6 support, use InetAddress
+ // .getAllByName(hostname) to resolve the IP addresses of a host.
+ // When the system property java.net.preferIPv4Stack is set to true,
+ // only IPv4 addresses are returned, and any IPv6 addresses are
+ // ignored, so no extra check is needed to exclude IPv6.
+ // When java.net.preferIPv4Stack is false, both IPv4 and IPv6
+ // addresses may be returned, and any IPv6 addresses will also be
+ // added as connectors.
+ // To disable IPv4, you need to configure the OS at the system level.
+ //
+ InetAddress[] addresses = InetAddress.getAllByName(ep.getHost());
+ server = addConnectors(
+ ep, addresses, server, httpConfig, backlogSize, idleTimeout);
+ }
+ server.loadListeners();
+ return server;
+ }
+
+ @VisibleForTesting
+ HttpServer2 addConnectors(
+ URI ep, InetAddress[] addresses, HttpServer2 server,
+ HttpConfiguration httpConfig, int backlogSize, int idleTimeout){
+ for (InetAddress addr : addresses) {
+ ServerConnector connector;
String scheme = ep.getScheme();
if (HTTP_SCHEME.equals(scheme)) {
- connector = createHttpChannelConnector(server.webServer,
- httpConfig);
+ connector = createHttpChannelConnector(
+ server.webServer, httpConfig);
} else if (HTTPS_SCHEME.equals(scheme)) {
- connector = createHttpsChannelConnector(server.webServer,
- httpConfig);
+ connector = createHttpsChannelConnector(
+ server.webServer, httpConfig);
} else {
throw new HadoopIllegalArgumentException(
"unknown scheme for endpoint:" + ep);
}
- connector.setHost(ep.getHost());
+ LOG.info("Adding connector to WebServer for address {}",
Review Comment:
Do we need info level for this? Debug might be enough.
> Add dual-stack/IPv6 Support to HttpServer2
> ------------------------------------------
>
> Key: HADOOP-19695
> URL: https://issues.apache.org/jira/browse/HADOOP-19695
> Project: Hadoop Common
> Issue Type: Sub-task
> Components: hadoop-common
> Reporter: Ferenc Erdelyi
> Assignee: Ferenc Erdelyi
> Priority: Minor
> Labels: pull-request-available
>
> To support clients connecting to JHS via IPv6, we need to equip the YARN
> WebApp class to bind to an IPv6 address. WebApp uses the HttpServer2, and
> adding the IPv6 connector to this class makes the solution more elegant.
> To enable dual-stack or IPv6 support, use InetAddress.getAllByName(hostname)
> to resolve the IP addresses of a host.
> When the system property java.net.preferIPv4Stack is set to true, only IPv4
> addresses are returned, and any IPv6 addresses are ignored, so no extra check
> is needed to exclude IPv6.
> When java.net.preferIPv4Stack is false, both IPv4 and IPv6 addresses may be
> returned, and any IPv6 addresses will also be added as connectors.
> To disable IPv4, you need to configure the OS at the system level.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]