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


Java ShardsAllocator类代码示例

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


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

示例1: createShardsAllocator

import org.elasticsearch.cluster.routing.allocation.allocator.ShardsAllocator; //导入依赖的package包/类
private static ShardsAllocator createShardsAllocator(Settings settings, ClusterSettings clusterSettings,
                                                     List<ClusterPlugin> clusterPlugins) {
    Map<String, Supplier<ShardsAllocator>> allocators = new HashMap<>();
    allocators.put(BALANCED_ALLOCATOR, () -> new BalancedShardsAllocator(settings, clusterSettings));

    for (ClusterPlugin plugin : clusterPlugins) {
        plugin.getShardsAllocators(settings, clusterSettings).forEach((k, v) -> {
            if (allocators.put(k, v) != null) {
                throw new IllegalArgumentException("ShardsAllocator [" + k + "] already defined");
            }
        });
    }
    String allocatorName = SHARDS_ALLOCATOR_TYPE_SETTING.get(settings);
    Supplier<ShardsAllocator> allocatorSupplier = allocators.get(allocatorName);
    if (allocatorSupplier == null) {
        throw new IllegalArgumentException("Unknown ShardsAllocator [" + allocatorName + "]");
    }
    return Objects.requireNonNull(allocatorSupplier.get(),
        "ShardsAllocator factory for [" + allocatorName + "] returned null");
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:ClusterModule.java

示例2: configure

import org.elasticsearch.cluster.routing.allocation.allocator.ShardsAllocator; //导入依赖的package包/类
@Override
protected void configure() {
    bind(GatewayAllocator.class).asEagerSingleton();
    bind(AllocationService.class).asEagerSingleton();
    bind(ClusterService.class).toInstance(clusterService);
    bind(NodeConnectionsService.class).asEagerSingleton();
    bind(MetaDataCreateIndexService.class).asEagerSingleton();
    bind(MetaDataDeleteIndexService.class).asEagerSingleton();
    bind(MetaDataIndexStateService.class).asEagerSingleton();
    bind(MetaDataMappingService.class).asEagerSingleton();
    bind(MetaDataIndexAliasesService.class).asEagerSingleton();
    bind(MetaDataUpdateSettingsService.class).asEagerSingleton();
    bind(MetaDataIndexTemplateService.class).asEagerSingleton();
    bind(IndexNameExpressionResolver.class).toInstance(indexNameExpressionResolver);
    bind(RoutingService.class).asEagerSingleton();
    bind(DelayedAllocationService.class).asEagerSingleton();
    bind(ShardStateAction.class).asEagerSingleton();
    bind(NodeMappingRefreshAction.class).asEagerSingleton();
    bind(MappingUpdatedAction.class).asEagerSingleton();
    bind(TaskResultsService.class).asEagerSingleton();
    bind(AllocationDeciders.class).toInstance(new AllocationDeciders(settings, allocationDeciders));
    bind(ShardsAllocator.class).toInstance(shardsAllocator);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:24,代码来源:ClusterModule.java

示例3: explainShard

import org.elasticsearch.cluster.routing.allocation.allocator.ShardsAllocator; //导入依赖的package包/类
public static ClusterAllocationExplanation explainShard(ShardRouting shardRouting, RoutingAllocation allocation,
                                                        ClusterInfo clusterInfo, boolean includeYesDecisions,
                                                        GatewayAllocator gatewayAllocator, ShardsAllocator shardAllocator) {
    allocation.setDebugMode(includeYesDecisions ? DebugMode.ON : DebugMode.EXCLUDE_YES_DECISIONS);

    ShardAllocationDecision shardDecision;
    if (shardRouting.initializing() || shardRouting.relocating()) {
        shardDecision = ShardAllocationDecision.NOT_TAKEN;
    } else {
        AllocateUnassignedDecision allocateDecision = shardRouting.unassigned() ?
            gatewayAllocator.decideUnassignedShardAllocation(shardRouting, allocation) : AllocateUnassignedDecision.NOT_TAKEN;
        if (allocateDecision.isDecisionTaken() == false) {
            shardDecision = shardAllocator.decideShardAllocation(shardRouting, allocation);
        } else {
            shardDecision = new ShardAllocationDecision(allocateDecision, MoveDecision.NOT_TAKEN);
        }
    }

    return new ClusterAllocationExplanation(shardRouting,
        shardRouting.currentNodeId() != null ? allocation.nodes().get(shardRouting.currentNodeId()) : null,
        shardRouting.relocatingNodeId() != null ? allocation.nodes().get(shardRouting.relocatingNodeId()) : null,
        clusterInfo, shardDecision);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:24,代码来源:TransportClusterAllocationExplainAction.java

示例4: AllocationService

import org.elasticsearch.cluster.routing.allocation.allocator.ShardsAllocator; //导入依赖的package包/类
@Inject
public AllocationService(Settings settings, AllocationDeciders allocationDeciders, GatewayAllocator gatewayAllocator,
                         ShardsAllocator shardsAllocator, ClusterInfoService clusterInfoService) {
    super(settings);
    this.allocationDeciders = allocationDeciders;
    this.gatewayAllocator = gatewayAllocator;
    this.shardsAllocator = shardsAllocator;
    this.clusterInfoService = clusterInfoService;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:AllocationService.java

示例5: TransportClusterAllocationExplainAction

import org.elasticsearch.cluster.routing.allocation.allocator.ShardsAllocator; //导入依赖的package包/类
@Inject
public TransportClusterAllocationExplainAction(Settings settings, TransportService transportService, ClusterService clusterService,
                                               ThreadPool threadPool, ActionFilters actionFilters,
                                               IndexNameExpressionResolver indexNameExpressionResolver,
                                               ClusterInfoService clusterInfoService, AllocationDeciders allocationDeciders,
                                               ShardsAllocator shardAllocator, GatewayAllocator gatewayAllocator) {
    super(settings, ClusterAllocationExplainAction.NAME, transportService, clusterService, threadPool, actionFilters,
            indexNameExpressionResolver, ClusterAllocationExplainRequest::new);
    this.clusterInfoService = clusterInfoService;
    this.allocationDeciders = allocationDeciders;
    this.shardAllocator = shardAllocator;
    this.gatewayAllocator = gatewayAllocator;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:14,代码来源:TransportClusterAllocationExplainAction.java

示例6: MockAllocationService

import org.elasticsearch.cluster.routing.allocation.allocator.ShardsAllocator; //导入依赖的package包/类
public MockAllocationService(Settings settings, AllocationDeciders allocationDeciders, GatewayAllocator gatewayAllocator,
                             ShardsAllocator shardsAllocator, ClusterInfoService clusterInfoService) {
    super(settings, allocationDeciders, gatewayAllocator, shardsAllocator, clusterInfoService);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:ESAllocationTestCase.java

示例7: registerShardsAllocator

import org.elasticsearch.cluster.routing.allocation.allocator.ShardsAllocator; //导入依赖的package包/类
public void registerShardsAllocator(String name, Class<? extends ShardsAllocator> clazz) {
    shardsAllocators.registerExtension(name, clazz);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:4,代码来源:ClusterModule.java

示例8: getShardsAllocators

import org.elasticsearch.cluster.routing.allocation.allocator.ShardsAllocator; //导入依赖的package包/类
/**
 * Return {@link ShardsAllocator} implementations added by this plugin.
 *
 * The key of the returned {@link Map} is the name of the allocator, and the value
 * is a function to construct the allocator.
 *
 * @param settings Settings for the node
 * @param clusterSettings Settings for the cluster
 * @return A map of allocator implementations
 */
default Map<String, Supplier<ShardsAllocator>> getShardsAllocators(Settings settings, ClusterSettings clusterSettings) {
    return Collections.emptyMap();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:14,代码来源:ClusterPlugin.java


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