當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。