当前位置: 首页>>代码示例>>Java>>正文


Java DiskThresholdDecider类代码示例

本文整理汇总了Java中org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDecider的典型用法代码示例。如果您正苦于以下问题:Java DiskThresholdDecider类的具体用法?Java DiskThresholdDecider怎么用?Java DiskThresholdDecider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DiskThresholdDecider类属于org.elasticsearch.cluster.routing.allocation.decider包,在下文中一共展示了DiskThresholdDecider类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createAllocationDeciders

import org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDecider; //导入依赖的package包/类
/** Return a new {@link AllocationDecider} instance with builtin deciders as well as those from plugins. */
public static Collection<AllocationDecider> createAllocationDeciders(Settings settings, ClusterSettings clusterSettings,
                                                                     List<ClusterPlugin> clusterPlugins) {
    // collect deciders by class so that we can detect duplicates
    Map<Class, AllocationDecider> deciders = new LinkedHashMap<>();
    addAllocationDecider(deciders, new MaxRetryAllocationDecider(settings));
    addAllocationDecider(deciders, new ReplicaAfterPrimaryActiveAllocationDecider(settings));
    addAllocationDecider(deciders, new RebalanceOnlyWhenActiveAllocationDecider(settings));
    addAllocationDecider(deciders, new ClusterRebalanceAllocationDecider(settings, clusterSettings));
    addAllocationDecider(deciders, new ConcurrentRebalanceAllocationDecider(settings, clusterSettings));
    addAllocationDecider(deciders, new EnableAllocationDecider(settings, clusterSettings));
    addAllocationDecider(deciders, new NodeVersionAllocationDecider(settings));
    addAllocationDecider(deciders, new SnapshotInProgressAllocationDecider(settings));
    addAllocationDecider(deciders, new FilterAllocationDecider(settings, clusterSettings));
    addAllocationDecider(deciders, new SameShardAllocationDecider(settings, clusterSettings));
    addAllocationDecider(deciders, new DiskThresholdDecider(settings, clusterSettings));
    addAllocationDecider(deciders, new ThrottlingAllocationDecider(settings, clusterSettings));
    addAllocationDecider(deciders, new ShardsLimitAllocationDecider(settings, clusterSettings));
    addAllocationDecider(deciders, new AwarenessAllocationDecider(settings, clusterSettings));

    clusterPlugins.stream()
        .flatMap(p -> p.createAllocationDeciders(settings, clusterSettings).stream())
        .forEach(d -> addAllocationDecider(deciders, d));

    return deciders.values();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:27,代码来源:ClusterModule.java

示例2: testAllocationDeciderOrder

import org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDecider; //导入依赖的package包/类
public void testAllocationDeciderOrder() {
    List<Class<? extends AllocationDecider>> expectedDeciders = Arrays.asList(
        MaxRetryAllocationDecider.class,
        ReplicaAfterPrimaryActiveAllocationDecider.class,
        RebalanceOnlyWhenActiveAllocationDecider.class,
        ClusterRebalanceAllocationDecider.class,
        ConcurrentRebalanceAllocationDecider.class,
        EnableAllocationDecider.class,
        NodeVersionAllocationDecider.class,
        SnapshotInProgressAllocationDecider.class,
        FilterAllocationDecider.class,
        SameShardAllocationDecider.class,
        DiskThresholdDecider.class,
        ThrottlingAllocationDecider.class,
        ShardsLimitAllocationDecider.class,
        AwarenessAllocationDecider.class);
    Collection<AllocationDecider> deciders = ClusterModule.createAllocationDeciders(Settings.EMPTY,
        new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS), Collections.emptyList());
    Iterator<AllocationDecider> iter = deciders.iterator();
    int idx = 0;
    while (iter.hasNext()) {
        AllocationDecider decider = iter.next();
        assertSame(decider.getClass(), expectedDeciders.get(idx++));
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:26,代码来源:ClusterModuleTests.java

示例3: InternalClusterInfoService

import org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDecider; //导入依赖的package包/类
@Inject
public InternalClusterInfoService(Settings settings, NodeSettingsService nodeSettingsService,
                                  TransportNodesStatsAction transportNodesStatsAction,
                                  TransportIndicesStatsAction transportIndicesStatsAction, ClusterService clusterService,
                                  ThreadPool threadPool) {
    super(settings);
    this.leastAvailableSpaceUsages = Collections.emptyMap();
    this.mostAvailableSpaceUsages = Collections.emptyMap();
    this.shardRoutingToDataPath = Collections.emptyMap();
    this.shardSizes = Collections.emptyMap();
    this.transportNodesStatsAction = transportNodesStatsAction;
    this.transportIndicesStatsAction = transportIndicesStatsAction;
    this.clusterService = clusterService;
    this.threadPool = threadPool;
    this.updateFrequency = settings.getAsTime(INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL, DEFAULT_UPDATE_INTERVAL);

    this.enabled = settings.getAsBoolean(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED, true);
    this.updateFrequency = settings.getAsTime(INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL, DEFAULT_UPDATE_INTERVAL);
    this.fetchTimeout = settings.getAsTime(INTERNAL_CLUSTER_INFO_TIMEOUT, DEFAULT_TIMEOUT);
    this.enabled = settings.getAsBoolean(
            DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED,
            DiskThresholdDecider.DEFAULT_THRESHOLD_ENABLED);
    nodeSettingsService.addListener(new ApplySettings());

    // Add InternalClusterInfoService to listen for Master changes
    this.clusterService.add((LocalNodeMasterListener)this);
    // Add to listen for state changes (when nodes are added)
    this.clusterService.add((ClusterStateListener)this);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:30,代码来源:InternalClusterInfoService.java

示例4: onRefreshSettings

import org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDecider; //导入依赖的package包/类
@Override
public void onRefreshSettings(Settings settings) {
    TimeValue newUpdateFrequency = settings.getAsTime(
            INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL,
            InternalClusterInfoService.this.settings.getAsTime(
                    INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL, DEFAULT_UPDATE_INTERVAL));
    // ClusterInfoService is only enabled if the DiskThresholdDecider is enabled
    Boolean newEnabled = settings.getAsBoolean(
            DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED,
            DiskThresholdDecider.DEFAULT_THRESHOLD_ENABLED);

    if (newUpdateFrequency != null && !updateFrequency.equals(newUpdateFrequency)) {
        if (newUpdateFrequency.getMillis() < TimeValue.timeValueSeconds(10).getMillis()) {
            logger.warn("[{}] set too low [{}] (< 10s)", INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL, newUpdateFrequency);
            throw new IllegalStateException("Unable to set " + INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL + " less than 10 seconds");
        } else {
            logger.info("updating [{}] from [{}] to [{}]", INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL, updateFrequency, newUpdateFrequency);
            InternalClusterInfoService.this.updateFrequency = newUpdateFrequency;
        }
    }

    TimeValue newFetchTimeout = settings.getAsTime(INTERNAL_CLUSTER_INFO_TIMEOUT,
            InternalClusterInfoService.this.settings.getAsTime(INTERNAL_CLUSTER_INFO_TIMEOUT, DEFAULT_TIMEOUT)
    );
    if (newFetchTimeout != null && !fetchTimeout.equals(newFetchTimeout)) {
        logger.info("updating fetch timeout [{}] from [{}] to [{}]", INTERNAL_CLUSTER_INFO_TIMEOUT, fetchTimeout, newFetchTimeout);
        InternalClusterInfoService.this.fetchTimeout = newFetchTimeout;
    }


    // We don't log about enabling it here, because the DiskThresholdDecider will already be logging about enable/disable
    if (newEnabled != InternalClusterInfoService.this.enabled) {
        InternalClusterInfoService.this.enabled = newEnabled;
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:36,代码来源:InternalClusterInfoService.java

示例5: nodeSettings

import org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDecider; //导入依赖的package包/类
/**
 * This method is used to obtain settings for the <tt>Nth</tt> node in the cluster.
 * Nodes in this cluster are associated with an ordinal number such that nodes can
 * be started with specific configurations. This method might be called multiple
 * times with the same ordinal and is expected to return the same value for each invocation.
 * In other words subclasses must ensure this method is idempotent.
 */
protected Settings nodeSettings(final int nodeOrdinal) {
    return settingsBuilder()
            // Default the watermarks to absurdly low to prevent the tests
            // from failing on nodes without enough disk space
            .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK, "1b")
            .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK, "1b").build();
}
 
开发者ID:salyh,项目名称:elasticsearch-sample-plugin-audit,代码行数:15,代码来源:ElasticsearchIntegrationTest.java

示例6: registerBuiltinClusterSettings

import org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDecider; //导入依赖的package包/类
private void registerBuiltinClusterSettings() {
    registerClusterDynamicSetting(AwarenessAllocationDecider.CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTES, Validator.EMPTY);
    registerClusterDynamicSetting(AwarenessAllocationDecider.CLUSTER_ROUTING_ALLOCATION_AWARENESS_FORCE_GROUP + "*", Validator.EMPTY);
    registerClusterDynamicSetting(BalancedShardsAllocator.SETTING_INDEX_BALANCE_FACTOR, Validator.FLOAT);
    registerClusterDynamicSetting(BalancedShardsAllocator.SETTING_SHARD_BALANCE_FACTOR, Validator.FLOAT);
    registerClusterDynamicSetting(BalancedShardsAllocator.SETTING_THRESHOLD, Validator.NON_NEGATIVE_FLOAT);
    registerClusterDynamicSetting(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE, ClusterRebalanceAllocationDecider.ALLOCATION_ALLOW_REBALANCE_VALIDATOR);
    registerClusterDynamicSetting(ConcurrentRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_CLUSTER_CONCURRENT_REBALANCE, Validator.INTEGER);
    registerClusterDynamicSetting(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE, Validator.EMPTY);
    registerClusterDynamicSetting(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE, Validator.EMPTY);
    registerClusterDynamicSetting(DisableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_DISABLE_NEW_ALLOCATION, Validator.EMPTY);
    registerClusterDynamicSetting(DisableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_DISABLE_ALLOCATION, Validator.EMPTY);
    registerClusterDynamicSetting(DisableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_DISABLE_REPLICA_ALLOCATION, Validator.EMPTY);
    registerClusterDynamicSetting(DiscoverySettings.NO_MASTER_BLOCK, Validator.EMPTY);
    registerClusterDynamicSetting(FilterAllocationDecider.CLUSTER_ROUTING_INCLUDE_GROUP + "*", Validator.EMPTY);
    registerClusterDynamicSetting(FilterAllocationDecider.CLUSTER_ROUTING_EXCLUDE_GROUP + "*", Validator.EMPTY);
    registerClusterDynamicSetting(FilterAllocationDecider.CLUSTER_ROUTING_REQUIRE_GROUP + "*", Validator.EMPTY);
    registerClusterDynamicSetting(IndicesStore.INDICES_STORE_THROTTLE_TYPE, Validator.EMPTY);
    registerClusterDynamicSetting(IndicesStore.INDICES_STORE_THROTTLE_MAX_BYTES_PER_SEC, Validator.BYTES_SIZE);
    registerClusterDynamicSetting(IndicesTTLService.INDICES_TTL_INTERVAL, Validator.TIME);
    registerClusterDynamicSetting(MappingUpdatedAction.INDICES_MAPPING_DYNAMIC_TIMEOUT, Validator.TIME);
    registerClusterDynamicSetting(MetaData.SETTING_READ_ONLY, Validator.EMPTY);
    registerClusterDynamicSetting(RecoverySettings.INDICES_RECOVERY_FILE_CHUNK_SIZE, Validator.POSITIVE_BYTES_SIZE);
    registerClusterDynamicSetting(RecoverySettings.INDICES_RECOVERY_TRANSLOG_OPS, Validator.INTEGER);
    registerClusterDynamicSetting(RecoverySettings.INDICES_RECOVERY_TRANSLOG_SIZE, Validator.BYTES_SIZE);
    registerClusterDynamicSetting(RecoverySettings.INDICES_RECOVERY_COMPRESS, Validator.EMPTY);
    registerClusterDynamicSetting(RecoverySettings.INDICES_RECOVERY_CONCURRENT_STREAMS, Validator.POSITIVE_INTEGER);
    registerClusterDynamicSetting(RecoverySettings.INDICES_RECOVERY_CONCURRENT_SMALL_FILE_STREAMS, Validator.POSITIVE_INTEGER);
    registerClusterDynamicSetting(RecoverySettings.INDICES_RECOVERY_MAX_BYTES_PER_SEC, Validator.BYTES_SIZE);
    registerClusterDynamicSetting(RecoverySettings.INDICES_RECOVERY_RETRY_DELAY_STATE_SYNC, Validator.TIME_NON_NEGATIVE);
    registerClusterDynamicSetting(RecoverySettings.INDICES_RECOVERY_RETRY_DELAY_NETWORK, Validator.TIME_NON_NEGATIVE);
    registerClusterDynamicSetting(RecoverySettings.INDICES_RECOVERY_ACTIVITY_TIMEOUT, Validator.TIME_NON_NEGATIVE);
    registerClusterDynamicSetting(RecoverySettings.INDICES_RECOVERY_INTERNAL_ACTION_TIMEOUT, Validator.TIME_NON_NEGATIVE);
    registerClusterDynamicSetting(RecoverySettings.INDICES_RECOVERY_INTERNAL_LONG_ACTION_TIMEOUT, Validator.TIME_NON_NEGATIVE);
    registerClusterDynamicSetting(RecoverySettings.INDICES_RECOVERY_MAX_SIZE_PER_SEC, Validator.BYTES_SIZE);
    registerClusterDynamicSetting(ThreadPool.THREADPOOL_GROUP + "*", ThreadPool.THREAD_POOL_TYPE_SETTINGS_VALIDATOR);
    registerClusterDynamicSetting(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_INITIAL_PRIMARIES_RECOVERIES, Validator.INTEGER);
    registerClusterDynamicSetting(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES, Validator.INTEGER);
    registerClusterDynamicSetting(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK, Validator.EMPTY);
    registerClusterDynamicSetting(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK, Validator.EMPTY);
    registerClusterDynamicSetting(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED, Validator.BOOLEAN);
    registerClusterDynamicSetting(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_INCLUDE_RELOCATIONS, Validator.BOOLEAN);
    registerClusterDynamicSetting(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL, Validator.TIME_NON_NEGATIVE);
    registerClusterDynamicSetting(InternalClusterInfoService.INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL, Validator.TIME_NON_NEGATIVE);
    registerClusterDynamicSetting(InternalClusterInfoService.INTERNAL_CLUSTER_INFO_TIMEOUT, Validator.TIME_NON_NEGATIVE);
    registerClusterDynamicSetting(SnapshotInProgressAllocationDecider.CLUSTER_ROUTING_ALLOCATION_SNAPSHOT_RELOCATION_ENABLED, Validator.EMPTY);
    registerClusterDynamicSetting(DestructiveOperations.REQUIRES_NAME, Validator.EMPTY);
    registerClusterDynamicSetting(DiscoverySettings.PUBLISH_TIMEOUT, Validator.TIME_NON_NEGATIVE);
    registerClusterDynamicSetting(DiscoverySettings.PUBLISH_DIFF_ENABLE, Validator.BOOLEAN);
    registerClusterDynamicSetting(HierarchyCircuitBreakerService.TOTAL_CIRCUIT_BREAKER_LIMIT_SETTING, Validator.MEMORY_SIZE);
    registerClusterDynamicSetting(HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_LIMIT_SETTING, Validator.MEMORY_SIZE);
    registerClusterDynamicSetting(HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_OVERHEAD_SETTING, Validator.NON_NEGATIVE_DOUBLE);
    registerClusterDynamicSetting(HierarchyCircuitBreakerService.REQUEST_CIRCUIT_BREAKER_LIMIT_SETTING, Validator.MEMORY_SIZE);
    registerClusterDynamicSetting(HierarchyCircuitBreakerService.REQUEST_CIRCUIT_BREAKER_OVERHEAD_SETTING, Validator.NON_NEGATIVE_DOUBLE);
    registerClusterDynamicSetting(InternalClusterService.SETTING_CLUSTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD, Validator.TIME_NON_NEGATIVE);
    registerClusterDynamicSetting(SearchService.DEFAULT_SEARCH_TIMEOUT, Validator.TIMEOUT);
    registerClusterDynamicSetting(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES, ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_VALIDATOR);
    registerClusterDynamicSetting(TransportService.SETTING_TRACE_LOG_INCLUDE, Validator.EMPTY);
    registerClusterDynamicSetting(TransportService.SETTING_TRACE_LOG_INCLUDE + ".*", Validator.EMPTY);
    registerClusterDynamicSetting(TransportService.SETTING_TRACE_LOG_EXCLUDE, Validator.EMPTY);
    registerClusterDynamicSetting(TransportService.SETTING_TRACE_LOG_EXCLUDE + ".*", Validator.EMPTY);
    registerClusterDynamicSetting(TransportCloseIndexAction.SETTING_CLUSTER_INDICES_CLOSE_ENABLE, Validator.BOOLEAN);
    registerClusterDynamicSetting(ShardsLimitAllocationDecider.CLUSTER_TOTAL_SHARDS_PER_NODE, Validator.INTEGER);
    registerClusterDynamicSetting(AuditService.AUDIT_LOG_THRESHOLD, Validator.TIME);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:66,代码来源:ClusterModule.java


注:本文中的org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDecider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。