-
Notifications
You must be signed in to change notification settings - Fork 3.8k
enable coordinator to act as overlord as well #3711
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| /* | ||
| * Licensed to Metamarkets Group Inc. (Metamarkets) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. Metamarkets licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package io.druid.server.coordinator; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
| import com.google.common.base.Preconditions; | ||
|
|
||
| /** | ||
| */ | ||
| public class CoordinatorOverlordServiceConfig | ||
| { | ||
| @JsonProperty | ||
| private final boolean enabled; | ||
|
|
||
| @JsonProperty | ||
| private final String overlordService; | ||
|
|
||
| public CoordinatorOverlordServiceConfig( | ||
| @JsonProperty("enabled") Boolean enabled, | ||
| @JsonProperty("overlordService") String overlordService | ||
| ) | ||
| { | ||
| this.enabled = enabled == null ? false : enabled.booleanValue(); | ||
| this.overlordService = overlordService; | ||
|
|
||
| Preconditions.checkArgument((this.enabled && this.overlordService != null) || !this.enabled, | ||
| "coordinator is enabled to be overlord but overlordService is not specified"); | ||
| } | ||
|
|
||
| public boolean isEnabled() | ||
| { | ||
| return enabled; | ||
| } | ||
|
|
||
| public String getOverlordService() | ||
| { | ||
| return overlordService; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,16 +37,20 @@ | |
| import org.eclipse.jetty.util.resource.Resource; | ||
| import org.eclipse.jetty.util.resource.ResourceCollection; | ||
|
|
||
| import java.util.Properties; | ||
|
|
||
| /** | ||
| */ | ||
| class CoordinatorJettyServerInitializer implements JettyServerInitializer | ||
| { | ||
| private final DruidCoordinatorConfig config; | ||
| private final boolean beOverlord; | ||
|
|
||
| @Inject | ||
| CoordinatorJettyServerInitializer(DruidCoordinatorConfig config) | ||
| CoordinatorJettyServerInitializer(DruidCoordinatorConfig config, Properties properties) | ||
| { | ||
| this.config = config; | ||
| this.beOverlord = CliCoordinator.isOverlord(properties); | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -59,10 +63,19 @@ public void initialize(Server server, Injector injector) | |
|
|
||
| root.addServlet(holderPwd, "/"); | ||
| if(config.getConsoleStatic() == null) { | ||
| ResourceCollection staticResources = new ResourceCollection( | ||
| Resource.newClassPathResource("io/druid/console"), | ||
| Resource.newClassPathResource("static") | ||
| ); | ||
| ResourceCollection staticResources; | ||
| if (beOverlord) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. have u tested this? are u sure both consoles work?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, i tested this. with this flag, coordinator console - http://host:port/
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you also verify that http://coordinator-host:port/#/indexing-service works ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes it works |
||
| staticResources = new ResourceCollection( | ||
| Resource.newClassPathResource("io/druid/console"), | ||
| Resource.newClassPathResource("static"), | ||
| Resource.newClassPathResource("indexer_static") | ||
| ); | ||
| } else { | ||
| staticResources = new ResourceCollection( | ||
| Resource.newClassPathResource("io/druid/console"), | ||
| Resource.newClassPathResource("static") | ||
| ); | ||
| } | ||
| root.setBaseResource(staticResources); | ||
| } else { | ||
| // used for console development | ||
|
|
@@ -81,10 +94,15 @@ public void initialize(Server server, Injector injector) | |
| // Can't use '/*' here because of Guice and Jetty static content conflicts | ||
| root.addFilter(GuiceFilter.class, "/info/*", null); | ||
| root.addFilter(GuiceFilter.class, "/druid/coordinator/*", null); | ||
| if (beOverlord) { | ||
| root.addFilter(GuiceFilter.class, "/druid/indexer/*", null); | ||
| } | ||
| // this will be removed in the next major release | ||
| root.addFilter(GuiceFilter.class, "/coordinator/*", null); | ||
|
|
||
| root.addServlet(new ServletHolder(injector.getInstance(OverlordProxyServlet.class)), "/druid/indexer/*"); | ||
| if (!beOverlord) { | ||
| root.addServlet(new ServletHolder(injector.getInstance(OverlordProxyServlet.class)), "/druid/indexer/*"); | ||
| } | ||
|
|
||
| HandlerList handlerList = new HandlerList(); | ||
| handlerList.setHandlers(new Handler[]{JettyServerInitUtils.getJettyRequestLogHandler(), root}); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handleIngestion?