org.elasticsearch.node.settings.NodeSettingsService Java Examples

The following examples show how to use org.elasticsearch.node.settings.NodeSettingsService. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StatsTables.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Inject
public StatsTables(Settings settings, NodeSettingsService nodeSettingsService) {
    int operationsLogSize = CrateSettings.STATS_OPERATIONS_LOG_SIZE.extract(settings);
    int jobsLogSize = CrateSettings.STATS_JOBS_LOG_SIZE.extract(settings);
    boolean isEnabled = CrateSettings.STATS_ENABLED.extract(settings);

    if (isEnabled) {
        setJobsLog(jobsLogSize);
        setOperationsLog(operationsLogSize);
    } else {
        setJobsLog(0);
        setOperationsLog(0);
    }

    lastOperationsLogSize = operationsLogSize;
    lastJobsLogSize = jobsLogSize;
    lastIsEnabled = isEnabled;

    nodeSettingsService.addListener(listener);
    jobsLogIterableGetter = new JobsLogIterableGetter();
    jobsIterableGetter = new JobsIterableGetter();
    operationsIterableGetter = new OperationsIterableGetter();
    operationsLogIterableGetter = new OperationsLogIterableGetter();
}
 
Example #2
Source File: TermsSetTest.java    From siren-join with GNU Affero General Public License v3.0 6 votes vote down vote up
@Test
public void testCircuitBreakerAdjustmentOnIntTermsSet() {
  HierarchyCircuitBreakerService hcbs = new HierarchyCircuitBreakerService(
          Settings.builder().build(),
          new NodeSettingsService(Settings.EMPTY));

  CircuitBreaker breaker = hcbs.getBreaker(CircuitBreaker.REQUEST);
  assertThat(breaker.getUsed(), is(equalTo(0L)));

  IntegerTermsSet termsSet = new IntegerTermsSet(8, hcbs.getBreaker(CircuitBreaker.REQUEST));
  long usedMem = breaker.getUsed();
  assertThat(usedMem, greaterThan(0L));

  for (int i = 0; i < 16; i++) {
    termsSet.add(i);
  }

  assertThat(breaker.getUsed(), greaterThan(usedMem));

  termsSet.release();

  assertThat(breaker.getUsed(), is(equalTo(0L)));
}
 
Example #3
Source File: TermsSetTest.java    From siren-join with GNU Affero General Public License v3.0 6 votes vote down vote up
@Test
public void testCircuitBreakerAdjustmentOnLongTermsSet() {
  HierarchyCircuitBreakerService hcbs = new HierarchyCircuitBreakerService(
          Settings.builder().build(),
          new NodeSettingsService(Settings.EMPTY));

  CircuitBreaker breaker = hcbs.getBreaker(CircuitBreaker.REQUEST);
  assertThat(breaker.getUsed(), is(equalTo(0L)));

  LongTermsSet termsSet = new LongTermsSet(8, hcbs.getBreaker(CircuitBreaker.REQUEST));
  long usedMem = breaker.getUsed();
  assertThat(usedMem, greaterThan(0L));

  for (int i = 0; i < 16; i++) {
    termsSet.add(i);
  }

  assertThat(breaker.getUsed(), greaterThan(usedMem));

  termsSet.release();

  assertThat(breaker.getUsed(), is(equalTo(0L)));
}
 
Example #4
Source File: CrateCircuitBreakerService.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Inject
public CrateCircuitBreakerService(Settings settings,
                                  NodeSettingsService nodeSettingsService,
                                  CircuitBreakerService esCircuitBreakerService) {
    super(settings);
    this.esCircuitBreakerService = esCircuitBreakerService;

    long memoryLimit = settings.getAsMemory(
            QUERY_CIRCUIT_BREAKER_LIMIT_SETTING,
            DEFAULT_QUERY_CIRCUIT_BREAKER_LIMIT).bytes();
    double overhead = settings.getAsDouble(
            QUERY_CIRCUIT_BREAKER_OVERHEAD_SETTING,
            DEFAULT_QUERY_CIRCUIT_BREAKER_OVERHEAD_CONSTANT);

    queryBreakerSettings = new BreakerSettings(QUERY, memoryLimit, overhead,
            CircuitBreaker.Type.parseValue(
                    settings.get(QUERY_CIRCUIT_BREAKER_TYPE_SETTING,
                    DEFAULT_QUERY_CIRCUIT_BREAKER_TYPE)));

    registerBreaker(queryBreakerSettings);
    nodeSettingsService.addListener(new ApplySettings());
}
 
Example #5
Source File: AwarenessAllocationDecider.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Inject
public AwarenessAllocationDecider(Settings settings, NodeSettingsService nodeSettingsService) {
    super(settings);
    this.awarenessAttributes = settings.getAsArray(CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTES);

    forcedAwarenessAttributes = Maps.newHashMap();
    Map<String, Settings> forceGroups = settings.getGroups(CLUSTER_ROUTING_ALLOCATION_AWARENESS_FORCE_GROUP);
    for (Map.Entry<String, Settings> entry : forceGroups.entrySet()) {
        String[] aValues = entry.getValue().getAsArray("values");
        if (aValues.length > 0) {
            forcedAwarenessAttributes.put(entry.getKey(), aValues);
        }
    }

    nodeSettingsService.addListener(new ApplySettings());
}
 
Example #6
Source File: FilterAllocationDecider.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Inject
public FilterAllocationDecider(Settings settings, NodeSettingsService nodeSettingsService) {
    super(settings);
    Map<String, String> requireMap = settings.getByPrefix(CLUSTER_ROUTING_REQUIRE_GROUP).getAsMap();
    if (requireMap.isEmpty()) {
        clusterRequireFilters = null;
    } else {
        clusterRequireFilters = DiscoveryNodeFilters.buildFromKeyValue(AND, requireMap);
    }
    Map<String, String> includeMap = settings.getByPrefix(CLUSTER_ROUTING_INCLUDE_GROUP).getAsMap();
    if (includeMap.isEmpty()) {
        clusterIncludeFilters = null;
    } else {
        clusterIncludeFilters = DiscoveryNodeFilters.buildFromKeyValue(OR, includeMap);
    }
    Map<String, String> excludeMap = settings.getByPrefix(CLUSTER_ROUTING_EXCLUDE_GROUP).getAsMap();
    if (excludeMap.isEmpty()) {
        clusterExcludeFilters = null;
    } else {
        clusterExcludeFilters = DiscoveryNodeFilters.buildFromKeyValue(OR, excludeMap);
    }
    nodeSettingsService.addListener(new ApplySettings());
}
 
Example #7
Source File: IndicesStore.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Inject
public IndicesStore(Settings settings, NodeSettingsService nodeSettingsService, IndicesService indicesService,
                    ClusterService clusterService, TransportService transportService) {
    super(settings);
    this.nodeSettingsService = nodeSettingsService;
    this.indicesService = indicesService;
    this.clusterService = clusterService;
    this.transportService = transportService;
    transportService.registerRequestHandler(ACTION_SHARD_EXISTS, ShardActiveRequest.class, ThreadPool.Names.SAME, new ShardActiveRequestHandler());

    // we don't limit by default (we default to CMS's auto throttle instead):
    this.rateLimitingType = settings.get("indices.store.throttle.type", DEFAULT_RATE_LIMITING_TYPE);
    rateLimiting.setType(rateLimitingType);
    this.rateLimitingThrottle = settings.getAsBytesSize("indices.store.throttle.max_bytes_per_sec", DEFAULT_INDICES_STORE_THROTTLE_MAX_BYTES_PER_SEC);
    rateLimiting.setMaxRate(rateLimitingThrottle);

    this.deleteShardTimeout = settings.getAsTime(INDICES_STORE_DELETE_SHARD_TIMEOUT, new TimeValue(30, TimeUnit.SECONDS));

    logger.debug("using indices.store.throttle.type [{}], with index.store.throttle.max_bytes_per_sec [{}]", rateLimitingType, rateLimitingThrottle);

    nodeSettingsService.addListener(applySettings);
    clusterService.addLast(this);
}
 
Example #8
Source File: NodeModule.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
protected void configure() {
    if (pageCacheRecyclerImpl == PageCacheRecycler.class) {
        bind(PageCacheRecycler.class).asEagerSingleton();
    } else {
        bind(PageCacheRecycler.class).to(pageCacheRecyclerImpl).asEagerSingleton();
    }
    if (bigArraysImpl == BigArrays.class) {
        bind(BigArrays.class).asEagerSingleton();
    } else {
        bind(BigArrays.class).to(bigArraysImpl).asEagerSingleton();
    }

    bind(Node.class).toInstance(node);
    bind(NodeSettingsService.class).asEagerSingleton();
    bind(NodeService.class).asEagerSingleton();
}
 
Example #9
Source File: TransportDeleteIndexAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportDeleteIndexAction(Settings settings, TransportService transportService, ClusterService clusterService,
                                  ThreadPool threadPool, MetaDataDeleteIndexService deleteIndexService,
                                  NodeSettingsService nodeSettingsService, ActionFilters actionFilters,
                                  IndexNameExpressionResolver indexNameExpressionResolver, DestructiveOperations destructiveOperations) {
    super(settings, DeleteIndexAction.NAME, transportService, clusterService, threadPool, actionFilters, indexNameExpressionResolver, DeleteIndexRequest.class);
    this.deleteIndexService = deleteIndexService;
    this.destructiveOperations = destructiveOperations;
}
 
Example #10
Source File: DiskThresholdDecider.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public DiskThresholdDecider(Settings settings, NodeSettingsService nodeSettingsService, ClusterInfoService infoService, Client client) {
    super(settings);
    String lowWatermark = settings.get(CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK,
            DEFAULT_LOW_DISK_WATERMARK);
    String highWatermark = settings.get(CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK,
            DEFAULT_HIGH_DISK_WATERMARK);

    if (!validWatermarkSetting(lowWatermark, CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK)) {
        throw new ElasticsearchParseException("unable to parse low watermark [{}]", lowWatermark);
    }
    if (!validWatermarkSetting(highWatermark, CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK)) {
        throw new ElasticsearchParseException("unable to parse high watermark [{}]", highWatermark);
    }
    // Watermark is expressed in terms of used data, but we need "free" data watermark
    this.freeDiskThresholdLow = 100.0 - thresholdPercentageFromWatermark(lowWatermark);
    this.freeDiskThresholdHigh = 100.0 - thresholdPercentageFromWatermark(highWatermark);

    this.freeBytesThresholdLow = thresholdBytesFromWatermark(lowWatermark, CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK);
    this.freeBytesThresholdHigh = thresholdBytesFromWatermark(highWatermark, CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK);
    this.includeRelocations = settings.getAsBoolean(CLUSTER_ROUTING_ALLOCATION_INCLUDE_RELOCATIONS,
            DEFAULT_INCLUDE_RELOCATIONS);
    this.rerouteInterval = settings.getAsTime(CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL, TimeValue.timeValueSeconds(60));

    this.enabled = settings.getAsBoolean(CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED,
            DEFAULT_THRESHOLD_ENABLED);
    nodeSettingsService.addListener(new ApplySettings());
    infoService.addListener(new DiskListener(client));
}
 
Example #11
Source File: ConcurrentRebalanceAllocationDecider.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public ConcurrentRebalanceAllocationDecider(Settings settings, NodeSettingsService nodeSettingsService) {
    super(settings);
    this.clusterConcurrentRebalance = settings.getAsInt(
            CLUSTER_ROUTING_ALLOCATION_CLUSTER_CONCURRENT_REBALANCE,
            DEFAULT_CLUSTER_ROUTING_ALLOCATION_CLUSTER_CONCURRENT_REBALANCE);
    logger.debug("using [cluster_concurrent_rebalance] with [{}]", clusterConcurrentRebalance);
    nodeSettingsService.addListener(new ApplySettings());
}
 
Example #12
Source File: ThrottlingAllocationDecider.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public ThrottlingAllocationDecider(Settings settings, NodeSettingsService nodeSettingsService) {
    super(settings);

    this.primariesInitialRecoveries = settings.getAsInt(CLUSTER_ROUTING_ALLOCATION_NODE_INITIAL_PRIMARIES_RECOVERIES, DEFAULT_CLUSTER_ROUTING_ALLOCATION_NODE_INITIAL_PRIMARIES_RECOVERIES);
    this.concurrentRecoveries = settings.getAsInt(CLUSTER_ROUTING_ALLOCATION_CONCURRENT_RECOVERIES, settings.getAsInt(CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES, DEFAULT_CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES));
    logger.debug("using node_concurrent_recoveries [{}], node_initial_primaries_recoveries [{}]", concurrentRecoveries, primariesInitialRecoveries);

    nodeSettingsService.addListener(new ApplySettings());
}
 
Example #13
Source File: InternalClusterService.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public InternalClusterService(Settings settings, DiscoveryService discoveryService, OperationRouting operationRouting, TransportService transportService,
                              NodeSettingsService nodeSettingsService, ThreadPool threadPool, ClusterName clusterName, DiscoveryNodeService discoveryNodeService, Version version) {
    super(settings);
    this.operationRouting = operationRouting;
    this.transportService = transportService;
    this.discoveryService = discoveryService;
    this.threadPool = threadPool;
    this.nodeSettingsService = nodeSettingsService;
    this.discoveryNodeService = discoveryNodeService;
    this.version = version;

    // will be replaced on doStart.
    this.clusterState = ClusterState.builder(clusterName).build();

    this.nodeSettingsService.setClusterService(this);
    this.nodeSettingsService.addListener(new ApplySettings());

    this.reconnectInterval = this.settings.getAsTime(SETTING_CLUSTER_SERVICE_RECONNECT_INTERVAL, TimeValue.timeValueSeconds(10));

    this.slowTaskLoggingThreshold = this.settings.getAsTime(SETTING_CLUSTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD, TimeValue.timeValueSeconds(30));

    localNodeMasterListeners = new LocalNodeMasterListeners(threadPool);

    initialBlocks = ClusterBlocks.builder().addGlobalBlock(discoveryService.getNoMasterBlock());

    taskManager = transportService.getTaskManager();

    this.auditService = new AuditService(nodeSettingsService);
}
 
Example #14
Source File: ThreadPool.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
public void setNodeSettingsService(NodeSettingsService nodeSettingsService) {
    if(settingsListenerIsSet) {
        throw new IllegalStateException("the node settings listener was set more then once");
    }
    nodeSettingsService.addListener(new ApplySettings());
    settingsListenerIsSet = true;
}
 
Example #15
Source File: TransportCloseIndexAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportCloseIndexAction(Settings settings, TransportService transportService, ClusterService clusterService,
                                 ThreadPool threadPool, MetaDataIndexStateService indexStateService,
                                 NodeSettingsService nodeSettingsService, ActionFilters actionFilters,
                                 IndexNameExpressionResolver indexNameExpressionResolver, DestructiveOperations destructiveOperations) {
    super(settings, CloseIndexAction.NAME, transportService, clusterService, threadPool, actionFilters, indexNameExpressionResolver, CloseIndexRequest.class);
    this.indexStateService = indexStateService;
    this.destructiveOperations = destructiveOperations;
    this.closeIndexEnabled = settings.getAsBoolean(SETTING_CLUSTER_INDICES_CLOSE_ENABLE, true);
    nodeSettingsService.addListener(this);
}
 
Example #16
Source File: EnableAllocationDecider.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public EnableAllocationDecider(Settings settings, NodeSettingsService nodeSettingsService) {
    super(settings);
    this.enableAllocation = Allocation.parse(settings.get(CLUSTER_ROUTING_ALLOCATION_ENABLE,
            this.settings.get(CLUSTER_ROUTING_ALLOCATION_ENABLE, Allocation.ALL.name())));
    this.enableRebalance = Rebalance.parse(settings.get(CLUSTER_ROUTING_REBALANCE_ENABLE,
            this.settings.get(CLUSTER_ROUTING_ALLOCATION_ENABLE, Rebalance.ALL.name())));
    nodeSettingsService.addListener(this);
}
 
Example #17
Source File: TransportOpenIndexAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportOpenIndexAction(Settings settings, TransportService transportService, ClusterService clusterService,
                                ThreadPool threadPool, MetaDataIndexStateService indexStateService,
                                NodeSettingsService nodeSettingsService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver,
                                DestructiveOperations destructiveOperations) {
    super(settings, OpenIndexAction.NAME, transportService, clusterService, threadPool, actionFilters, indexNameExpressionResolver, OpenIndexRequest.class);
    this.indexStateService = indexStateService;
    this.destructiveOperations = destructiveOperations;
}
 
Example #18
Source File: TermsSetTest.java    From siren-join with GNU Affero General Public License v3.0 5 votes vote down vote up
@Test(expected=CircuitBreakingException.class)
public void testCircuitBreakerOnNewLongTermsSet() {
  final int size = 42;
  HierarchyCircuitBreakerService hcbs = new HierarchyCircuitBreakerService(
          Settings.builder()
                  .put(HierarchyCircuitBreakerService.REQUEST_CIRCUIT_BREAKER_LIMIT_SETTING, size - 1, ByteSizeUnit.BYTES)
                  .build(),
          new NodeSettingsService(Settings.EMPTY));

  LongTermsSet termsSet = new LongTermsSet(size, hcbs.getBreaker(CircuitBreaker.REQUEST));
}
 
Example #19
Source File: TermsSetTest.java    From siren-join with GNU Affero General Public License v3.0 5 votes vote down vote up
@Test(expected=CircuitBreakingException.class)
public void testCircuitBreakerOnNewIntTermsSet() {
  final int size = 42;
  HierarchyCircuitBreakerService hcbs = new HierarchyCircuitBreakerService(
          Settings.builder()
                  .put(HierarchyCircuitBreakerService.REQUEST_CIRCUIT_BREAKER_LIMIT_SETTING, size - 1, ByteSizeUnit.BYTES)
                  .build(),
          new NodeSettingsService(Settings.EMPTY));

  IntegerTermsSet termsSet = new IntegerTermsSet(size, hcbs.getBreaker(CircuitBreaker.REQUEST));
}
 
Example #20
Source File: SrvtestDiscovery.java    From elasticsearch-srv-discovery with MIT License 5 votes vote down vote up
@Inject
public SrvtestDiscovery(Settings settings, ClusterName clusterName, ThreadPool threadPool, TransportService transportService,
                    ClusterService clusterService, NodeSettingsService nodeSettingsService, ZenPingService pingService,
                    DiscoveryNodeService discoveryNodeService,DiscoverySettings discoverySettings,
                    ElectMasterService electMasterService, DynamicSettings dynamicSettings) {
    super(settings, clusterName, threadPool, transportService, clusterService, nodeSettingsService,
            discoveryNodeService, pingService, electMasterService, discoverySettings, dynamicSettings);
}
 
Example #21
Source File: SrvDiscovery.java    From elasticsearch-srv-discovery with MIT License 5 votes vote down vote up
@Inject
public SrvDiscovery(Settings settings, ClusterName clusterName, ThreadPool threadPool, TransportService transportService,
                    ClusterService clusterService, NodeSettingsService nodeSettingsService, ZenPingService pingService,
                    DiscoveryNodeService discoveryNodeService,DiscoverySettings discoverySettings,
                    ElectMasterService electMasterService, DynamicSettings dynamicSettings) {
    super(settings, clusterName, threadPool, transportService, clusterService, nodeSettingsService,
            discoveryNodeService, pingService, electMasterService, discoverySettings, dynamicSettings);
}
 
Example #22
Source File: TransportDeleteNodeAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportDeleteNodeAction(Settings settings, TransportService transportService, ClusterService clusterService,
                                  ThreadPool threadPool, MetaDataDeleteIndexService deleteIndexService,
                                  NodeSettingsService nodeSettingsService, ActionFilters actionFilters,
                                  IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, DeleteNodeAction.NAME, transportService, clusterService, threadPool, actionFilters, indexNameExpressionResolver, DeleteNodeRequest.class);
}
 
Example #23
Source File: TransportAddNodeAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportAddNodeAction(Settings settings, TransportService transportService, ClusterService clusterService,
                                  ThreadPool threadPool, MetaDataDeleteIndexService deleteIndexService,
                                  NodeSettingsService nodeSettingsService, ActionFilters actionFilters,
                                  IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, AddNodeAction.NAME, transportService, clusterService, threadPool, actionFilters, indexNameExpressionResolver, AddNodeRequest.class);
}
 
Example #24
Source File: ClusterSettingsExpression.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public ClusterSettingsExpression(Settings settings, NodeSettingsService nodeSettingsService, ClusterService clusterService) {
    this.clusterService = clusterService;
    setDefaultValues(CrateSettings.SETTINGS);
    ApplySettings applySettings = new ApplySettings(settings, values);

    nodeSettingsService.addListener(applySettings);
    addChildImplementations();
}
 
Example #25
Source File: SrvDiscovery.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public SrvDiscovery(Settings settings, ClusterName clusterName, ThreadPool threadPool,
                    TransportService transportService,
                    ClusterService clusterService,
                    NodeSettingsService nodeSettingsService,
                    ZenPingService pingService,
                    ElectMasterService electMasterService, DiscoverySettings discoverySettings) {
    super(settings, clusterName, threadPool, transportService, clusterService, nodeSettingsService, pingService, electMasterService, discoverySettings);
}
 
Example #26
Source File: ClusterRebalanceAllocationDecider.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public ClusterRebalanceAllocationDecider(Settings settings, NodeSettingsService nodeSettingsService) {
    super(settings);
    String allowRebalance = settings.get(CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE, "indices_all_active");
    try {
        type = ClusterRebalanceType.parseString(allowRebalance);
    } catch (IllegalStateException e) {
        logger.warn("[{}] has a wrong value {}, defaulting to 'indices_all_active'", CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE, allowRebalance);
        type = ClusterRebalanceType.INDICES_ALL_ACTIVE;
    }
    logger.debug("using [{}] with [{}]", CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE, type.toString().toLowerCase(Locale.ROOT));

    nodeSettingsService.addListener(new ApplySettings());
}
 
Example #27
Source File: DisableAllocationDecider.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public DisableAllocationDecider(Settings settings, NodeSettingsService nodeSettingsService) {
    super(settings);
    this.disableNewAllocation = settings.getAsBoolean(CLUSTER_ROUTING_ALLOCATION_DISABLE_NEW_ALLOCATION, false);
    this.disableAllocation = settings.getAsBoolean(CLUSTER_ROUTING_ALLOCATION_DISABLE_ALLOCATION, false);
    this.disableReplicaAllocation = settings.getAsBoolean(CLUSTER_ROUTING_ALLOCATION_DISABLE_REPLICA_ALLOCATION, false);

    nodeSettingsService.addListener(new ApplySettings());
}
 
Example #28
Source File: DecommissionAllocationDecider.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public DecommissionAllocationDecider(Settings settings, NodeSettingsService nodeSettingsService) {
    super(settings);
    ApplySettings applySettings = new ApplySettings();
    applySettings.onRefreshSettings(settings);
    nodeSettingsService.addListener(applySettings);
}
 
Example #29
Source File: BalancedShardsAllocator.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public BalancedShardsAllocator(Settings settings, NodeSettingsService nodeSettingsService) {
    super(settings);
    ApplySettings applySettings = new ApplySettings();
    applySettings.onRefreshSettings(settings);
    nodeSettingsService.addListener(applySettings);
}
 
Example #30
Source File: DecommissioningService.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public DecommissioningService(Settings settings,
                              final ClusterService clusterService,
                              NodeSettingsService nodeSettingsService,
                              TransportSQLAction sqlAction,
                              TransportSQLBulkAction sqlBulkAction,
                              final TransportClusterHealthAction healthAction,
                              final TransportClusterUpdateSettingsAction updateSettingsAction) {
    super(settings);
    this.clusterService = clusterService;
    this.sqlAction = sqlAction;
    this.sqlBulkAction = sqlBulkAction;
    this.healthAction = healthAction;
    this.updateSettingsAction = updateSettingsAction;

    ApplySettings applySettings = new ApplySettings();
    applySettings.onRefreshSettings(settings);
    nodeSettingsService.addListener(applySettings);

    clusterService.add(new ClusterStateListener() {
        @Override
        public void clusterChanged(ClusterChangedEvent event) {
            removeRemovedNodes(event);
        }
    });
    try {
        Signal signal = new Signal("USR2");
        Signal.handle(signal, this);
    } catch (IllegalArgumentException e) {
        logger.warn("SIGUSR2 signal not supported on {}.", System.getProperty("os.name"), e);
    }
}