YARN-6069. CORS support in timeline v2 (Rohith Sharma K S via Varun Saxena)
This commit is contained in:
parent
6d356b6b4d
commit
229c7c9f89
|
@ -3068,4 +3068,15 @@
|
|||
<value>64</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<description>
|
||||
Flag to enable cross-origin (CORS) support for timeline service v1.x or
|
||||
Timeline Reader in timeline service v2. For timeline service v2, also add
|
||||
org.apache.hadoop.security.HttpCrossOriginFilterInitializer to the
|
||||
configuration hadoop.http.filter.initializers in core-site.xml.
|
||||
</description>
|
||||
<name>yarn.timeline-service.http-cross-origin.enabled</name>
|
||||
<value>false</value>
|
||||
</property>
|
||||
|
||||
</configuration>
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
|||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.http.HttpServer2;
|
||||
import org.apache.hadoop.http.lib.StaticUserWebFilter;
|
||||
import org.apache.hadoop.security.HttpCrossOriginFilterInitializer;
|
||||
import org.apache.hadoop.service.CompositeService;
|
||||
import org.apache.hadoop.util.ExitUtil;
|
||||
import org.apache.hadoop.util.ReflectionUtils;
|
||||
|
@ -134,6 +135,14 @@ public class TimelineReaderServer extends CompositeService {
|
|||
YarnConfiguration.TIMELINE_SERVICE_BIND_HOST,
|
||||
WebAppUtils.getTimelineReaderWebAppURL(conf));
|
||||
LOG.info("Instantiating TimelineReaderWebApp at " + bindAddress);
|
||||
boolean enableCorsFilter = conf.getBoolean(
|
||||
YarnConfiguration.TIMELINE_SERVICE_HTTP_CROSS_ORIGIN_ENABLED,
|
||||
YarnConfiguration.TIMELINE_SERVICE_HTTP_CROSS_ORIGIN_ENABLED_DEFAULT);
|
||||
// setup CORS
|
||||
if (enableCorsFilter) {
|
||||
conf.setBoolean(HttpCrossOriginFilterInitializer.PREFIX
|
||||
+ HttpCrossOriginFilterInitializer.ENABLED_SUFFIX, true);
|
||||
}
|
||||
try {
|
||||
HttpServer2.Builder builder = new HttpServer2.Builder()
|
||||
.setName("timeline")
|
||||
|
|
|
@ -142,6 +142,15 @@ New configuration parameters that are introduced with v.2 are marked bold.
|
|||
| **`yarn.timeline-service.hbase.coprocessor.app-final-value-retention-milliseconds`** | The setting that controls how long the final value of a metric of a completed app is retained before merging into the flow sum. Defaults to `259200000` (3 days). This should be set in the HBase cluster. |
|
||||
| **`yarn.rm.system-metrics-publisher.emit-container-events`** | The setting that controls whether yarn container metrics is published to the timeline server or not by RM. This configuration setting is for ATS V2. Defaults to `false`. |
|
||||
|
||||
#### Enabling CORS support
|
||||
To enable cross-origin support (CORS) for the Timeline Service v.2, please set the following configuration parameters:
|
||||
|
||||
In yarn-site.xml, set yarn.timeline-service.http-cross-origin.enabled to true.
|
||||
|
||||
In core-site.xml, add org.apache.hadoop.security.HttpCrossOriginFilterInitializer to hadoop.http.filter.initializers.
|
||||
|
||||
For more configurations used for cross-origin support, refer to [HttpAuthentication](../../hadoop-project-dist/hadoop-common/HttpAuthentication.html#CORS). Please note that yarn.timeline-service.http-cross-origin.enabled, if set to true, overrides hadoop.http.cross-origin.enabled.
|
||||
|
||||
|
||||
|
||||
### <a name="Enabling_Timeline_Service_v2"></a>Enabling Timeline Service v.2
|
||||
|
|
Loading…
Reference in New Issue