Search in sources :

Example 1 with LoadQueueTaskMaster

use of io.druid.server.coordinator.LoadQueueTaskMaster in project druid by druid-io.

the class CliCoordinator method getModules.

@Override
protected List<? extends Module> getModules() {
    List<Module> modules = new ArrayList<>();
    modules.add(new Module() {

        @Override
        public void configure(Binder binder) {
            binder.bindConstant().annotatedWith(Names.named("serviceName")).to(TieredBrokerConfig.DEFAULT_COORDINATOR_SERVICE_NAME);
            binder.bindConstant().annotatedWith(Names.named("servicePort")).to(8081);
            ConfigProvider.bind(binder, DruidCoordinatorConfig.class);
            binder.bind(MetadataStorage.class).toProvider(MetadataStorageProvider.class);
            JsonConfigProvider.bind(binder, "druid.manager.segments", MetadataSegmentManagerConfig.class);
            JsonConfigProvider.bind(binder, "druid.manager.rules", MetadataRuleManagerConfig.class);
            JsonConfigProvider.bind(binder, "druid.manager.lookups", LookupCoordinatorManagerConfig.class);
            JsonConfigProvider.bind(binder, "druid.coordinator.balancer", BalancerStrategyFactory.class);
            binder.bind(RedirectFilter.class).in(LazySingleton.class);
            if (beOverlord) {
                binder.bind(RedirectInfo.class).to(CoordinatorOverlordRedirectInfo.class).in(LazySingleton.class);
            } else {
                binder.bind(RedirectInfo.class).to(CoordinatorRedirectInfo.class).in(LazySingleton.class);
            }
            binder.bind(MetadataSegmentManager.class).toProvider(MetadataSegmentManagerProvider.class).in(ManageLifecycle.class);
            binder.bind(MetadataRuleManager.class).toProvider(MetadataRuleManagerProvider.class).in(ManageLifecycle.class);
            binder.bind(AuditManager.class).toProvider(AuditManagerProvider.class).in(ManageLifecycle.class);
            binder.bind(IndexingServiceClient.class).in(LazySingleton.class);
            binder.bind(CoordinatorServerView.class).in(LazySingleton.class);
            binder.bind(DruidCoordinator.class);
            binder.bind(LookupCoordinatorManager.class).in(ManageLifecycle.class);
            binder.bind(ListenerDiscoverer.class).in(ManageLifecycle.class);
            LifecycleModule.register(binder, ListenerDiscoverer.class);
            LifecycleModule.register(binder, MetadataStorage.class);
            LifecycleModule.register(binder, DruidCoordinator.class);
            LifecycleModule.register(binder, LookupCoordinatorManager.class);
            binder.bind(JettyServerInitializer.class).to(CoordinatorJettyServerInitializer.class);
            Jerseys.addResource(binder, CoordinatorResource.class);
            Jerseys.addResource(binder, CoordinatorDynamicConfigsResource.class);
            Jerseys.addResource(binder, TiersResource.class);
            Jerseys.addResource(binder, RulesResource.class);
            Jerseys.addResource(binder, ServersResource.class);
            Jerseys.addResource(binder, DatasourcesResource.class);
            Jerseys.addResource(binder, MetadataResource.class);
            Jerseys.addResource(binder, IntervalsResource.class);
            Jerseys.addResource(binder, LookupCoordinatorResource.class);
            LifecycleModule.register(binder, Server.class);
            LifecycleModule.register(binder, DatasourcesResource.class);
            ConditionalMultibind.create(properties, binder, DruidCoordinatorHelper.class, CoordinatorIndexingServiceHelper.class).addConditionBinding("druid.coordinator.merge.on", Predicates.equalTo("true"), DruidCoordinatorSegmentMerger.class).addConditionBinding("druid.coordinator.conversion.on", Predicates.equalTo("true"), DruidCoordinatorVersionConverter.class).addConditionBinding("druid.coordinator.kill.on", Predicates.equalTo("true"), DruidCoordinatorSegmentKiller.class);
        }

        @Provides
        @LazySingleton
        public LoadQueueTaskMaster getLoadQueueTaskMaster(CuratorFramework curator, ObjectMapper jsonMapper, ScheduledExecutorFactory factory, DruidCoordinatorConfig config) {
            return new LoadQueueTaskMaster(curator, jsonMapper, factory.create(1, "Master-PeonExec--%d"), Executors.newSingleThreadExecutor(), config);
        }
    });
    if (beOverlord) {
        modules.addAll(new CliOverlord().getModules(false));
    }
    return modules;
}
Also used : MetadataSegmentManager(io.druid.metadata.MetadataSegmentManager) MetadataRuleManager(io.druid.metadata.MetadataRuleManager) Server(org.eclipse.jetty.server.Server) ArrayList(java.util.ArrayList) CoordinatorResource(io.druid.server.http.CoordinatorResource) LookupCoordinatorResource(io.druid.server.http.LookupCoordinatorResource) ServersResource(io.druid.server.http.ServersResource) ListenerDiscoverer(io.druid.server.listener.announcer.ListenerDiscoverer) Binder(com.google.inject.Binder) LazySingleton(io.druid.guice.LazySingleton) LookupCoordinatorManager(io.druid.server.lookup.cache.LookupCoordinatorManager) TiersResource(io.druid.server.http.TiersResource) CuratorFramework(org.apache.curator.framework.CuratorFramework) DruidCoordinatorConfig(io.druid.server.coordinator.DruidCoordinatorConfig) LookupCoordinatorManagerConfig(io.druid.server.lookup.cache.LookupCoordinatorManagerConfig) AuditManager(io.druid.audit.AuditManager) DruidCoordinator(io.druid.server.coordinator.DruidCoordinator) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) MetadataStorageProvider(io.druid.metadata.MetadataStorageProvider) MetadataResource(io.druid.server.http.MetadataResource) DruidCoordinatorSegmentMerger(io.druid.server.coordinator.helper.DruidCoordinatorSegmentMerger) RulesResource(io.druid.server.http.RulesResource) BalancerStrategyFactory(io.druid.server.coordinator.BalancerStrategyFactory) ManageLifecycle(io.druid.guice.ManageLifecycle) Provides(com.google.inject.Provides) MetadataSegmentManagerConfig(io.druid.metadata.MetadataSegmentManagerConfig) CoordinatorDynamicConfigsResource(io.druid.server.http.CoordinatorDynamicConfigsResource) IntervalsResource(io.druid.server.http.IntervalsResource) DatasourcesResource(io.druid.server.http.DatasourcesResource) MetadataRuleManagerConfig(io.druid.metadata.MetadataRuleManagerConfig) LookupCoordinatorResource(io.druid.server.http.LookupCoordinatorResource) ScheduledExecutorFactory(io.druid.java.util.common.concurrent.ScheduledExecutorFactory) MetadataStorage(io.druid.metadata.MetadataStorage) DruidCoordinatorSegmentKiller(io.druid.server.coordinator.helper.DruidCoordinatorSegmentKiller) RedirectInfo(io.druid.server.http.RedirectInfo) CoordinatorRedirectInfo(io.druid.server.http.CoordinatorRedirectInfo) Module(com.google.inject.Module) LifecycleModule(io.druid.guice.LifecycleModule) LoadQueueTaskMaster(io.druid.server.coordinator.LoadQueueTaskMaster)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Binder (com.google.inject.Binder)1 Module (com.google.inject.Module)1 Provides (com.google.inject.Provides)1 AuditManager (io.druid.audit.AuditManager)1 LazySingleton (io.druid.guice.LazySingleton)1 LifecycleModule (io.druid.guice.LifecycleModule)1 ManageLifecycle (io.druid.guice.ManageLifecycle)1 ScheduledExecutorFactory (io.druid.java.util.common.concurrent.ScheduledExecutorFactory)1 MetadataRuleManager (io.druid.metadata.MetadataRuleManager)1 MetadataRuleManagerConfig (io.druid.metadata.MetadataRuleManagerConfig)1 MetadataSegmentManager (io.druid.metadata.MetadataSegmentManager)1 MetadataSegmentManagerConfig (io.druid.metadata.MetadataSegmentManagerConfig)1 MetadataStorage (io.druid.metadata.MetadataStorage)1 MetadataStorageProvider (io.druid.metadata.MetadataStorageProvider)1 BalancerStrategyFactory (io.druid.server.coordinator.BalancerStrategyFactory)1 DruidCoordinator (io.druid.server.coordinator.DruidCoordinator)1 DruidCoordinatorConfig (io.druid.server.coordinator.DruidCoordinatorConfig)1 LoadQueueTaskMaster (io.druid.server.coordinator.LoadQueueTaskMaster)1 DruidCoordinatorSegmentKiller (io.druid.server.coordinator.helper.DruidCoordinatorSegmentKiller)1