Skip to content
9 changes: 4 additions & 5 deletions hadoop-hdds/common/src/main/resources/ozone-default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2935,11 +2935,10 @@
<description>
The base dir for HTTP Jetty server to extract contents. If this property
is not configured, by default, Jetty will create a directory inside the
directory named by the java.io.tmpdir System property(/tmp by default).
Comment thread
ArafatKhan2198 marked this conversation as resolved.
While in production environment, it's strongly suggested to instruct Jetty
to use a different parent directory by setting this property to the name
of the desired parent directory. The value of the property will be used to
set Jetty context attribute 'org.eclipse.jetty.webapp.basetempdir'.
directory named by the ozone.metadata.dirs. While in production environment,
it's strongly suggested instructing Jetty to use a different parent directory by
setting this property to the name of the desired parent directory. The value of the
property will be used to set Jetty context attribute 'org.eclipse.jetty.webapp.basetempdir'.
The directory named by this property must exist and be writeable.
</description>
</property>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import static org.apache.hadoop.hdds.HddsUtils.getHostNameFromConfigKeys;
import static org.apache.hadoop.hdds.HddsUtils.getPortNumberFromConfigKeys;
import static org.apache.hadoop.hdds.HddsUtils.createDir;
import static org.apache.hadoop.hdds.server.ServerUtils.getOzoneMetaDirPath;
import static org.apache.hadoop.hdds.server.http.HttpConfig.getHttpPolicy;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_ADMINISTRATORS;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_ADMINISTRATORS_GROUPS;
Expand Down Expand Up @@ -70,6 +71,7 @@ public abstract class BaseHttpServer {
static final String PROMETHEUS_SINK = "PROMETHEUS_SINK";
private static final String JETTY_BASETMPDIR =
"org.eclipse.jetty.webapp.basetempdir";
private final String serverDir = "/webserver";

private HttpServer2 httpServer;
private final MutableConfigurationSource conf;
Expand Down Expand Up @@ -178,11 +180,14 @@ public BaseHttpServer(MutableConfigurationSource conf, String name)
}

String baseDir = conf.get(OzoneConfigKeys.OZONE_HTTP_BASEDIR);
if (!StringUtils.isEmpty(baseDir)) {
createDir(baseDir);
httpServer.getWebAppContext().setAttribute(JETTY_BASETMPDIR, baseDir);
LOG.info("HTTP server of {} uses base directory {}", name, baseDir);

if (StringUtils.isEmpty(baseDir)) {
baseDir =
conf.get(String.valueOf(getOzoneMetaDirPath(conf))) + serverDir;
Comment thread
ArafatKhan2198 marked this conversation as resolved.
Outdated
}
createDir(baseDir);
httpServer.getWebAppContext().setAttribute(JETTY_BASETMPDIR, baseDir);
LOG.info("HTTP server of {} uses base directory {}", name, baseDir);
}
}

Expand Down