Search in sources :

Example 1 with HostResource

use of com.yahoo.vespa.model.HostResource in project vespa by vespa-engine.

the class Admin method addFileDistribution.

private void addFileDistribution(HostResource host) {
    FileDistributor fileDistributor = fileDistribution.getFileDistributor();
    HostResource deployHost = getHostSystem().getHostByHostname(fileDistributor.fileSourceHost());
    if (deployHostIsMissing(deployHost)) {
        throw new RuntimeException("Could not find host in the application's host system: '" + fileDistributor.fileSourceHost() + "'. Hostsystem=" + getHostSystem());
    }
    FileDistributionConfigProvider configProvider = new FileDistributionConfigProvider(fileDistribution, fileDistributor, host == deployHost, host.getHost());
    fileDistribution.addFileDistributionConfigProducer(host.getHost(), configProvider);
}
Also used : HostResource(com.yahoo.vespa.model.HostResource) FileDistributor(com.yahoo.vespa.model.filedistribution.FileDistributor) FileDistributionConfigProvider(com.yahoo.vespa.model.filedistribution.FileDistributionConfigProvider)

Example 2 with HostResource

use of com.yahoo.vespa.model.HostResource in project vespa by vespa-engine.

the class Admin method createDefaultSlobrokSetup.

// If not configured by user: Use default setup: max 3 slobroks, 1 on the default configserver host
private List<Slobrok> createDefaultSlobrokSetup() {
    List<HostResource> hosts = getHostSystem().getHosts();
    List<Slobrok> slobs = new ArrayList<>();
    if (logserver != null) {
        Slobrok slobrok = new Slobrok(this, 0);
        addAndInitializeService(logserver.getHostResource(), slobrok);
        slobs.add(slobrok);
    }
    int n = 0;
    while ((n < hosts.size()) && (slobs.size() < 3)) {
        HostResource host = hosts.get(n);
        if ((logserver == null || host != logserver.getHostResource()) && !host.getHost().runsConfigServer()) {
            Slobrok newSlobrok = new Slobrok(this, slobs.size());
            addAndInitializeService(host, newSlobrok);
            slobs.add(newSlobrok);
        }
        n++;
    }
    int j = 0;
    for (Slobrok s : slobs) {
        s.setProp("index", j);
        j++;
    }
    return slobs;
}
Also used : HostResource(com.yahoo.vespa.model.HostResource) ArrayList(java.util.ArrayList)

Example 3 with HostResource

use of com.yahoo.vespa.model.HostResource in project vespa by vespa-engine.

the class DomAdminV4Builder method createSlobroks.

private void createSlobroks(Admin admin, Collection<HostResource> hosts) {
    // No slobroks can be created (and none are needed)
    if (hosts.isEmpty())
        return;
    List<Slobrok> slobroks = new ArrayList<>();
    int index = 0;
    for (HostResource host : hosts) {
        Slobrok slobrok = new Slobrok(admin, index++);
        slobrok.setHostResource(host);
        slobroks.add(slobrok);
        slobrok.initService();
    }
    admin.addSlobroks(slobroks);
}
Also used : HostResource(com.yahoo.vespa.model.HostResource) ArrayList(java.util.ArrayList) Slobrok(com.yahoo.vespa.model.admin.Slobrok)

Example 4 with HostResource

use of com.yahoo.vespa.model.HostResource in project vespa by vespa-engine.

the class DomAdminV4Builder method pickContainerHostsForSlobrok.

/**
 * Returns a list of container hosts to use for an auxiliary cluster.
 * The list returns the same nodes on each invocation given the same available nodes.
 *
 * @param count the desired number of nodes. More nodes may be returned to ensure a smooth transition
 *        on topology changes, and less nodes may be returned if fewer are available
 * @param minHostsPerContainerCluster the desired number of hosts per cluster
 */
private List<HostResource> pickContainerHostsForSlobrok(int count, int minHostsPerContainerCluster) {
    Collection<ContainerModel> containerModelsWithSlobrok = containerModels.stream().filter(this::shouldHaveSlobrok).collect(Collectors.toList());
    int hostsPerCluster = (int) Math.max(minHostsPerContainerCluster, Math.ceil((double) count / containerModelsWithSlobrok.size()));
    // Pick from all container clusters to make sure we don't lose all nodes at once if some clusters are removed.
    // This will overshoot the desired size (due to ceil and picking at least one node per cluster).
    List<HostResource> picked = new ArrayList<>();
    for (ContainerModel containerModel : containerModelsWithSlobrok) picked.addAll(pickContainerHostsFrom(containerModel, hostsPerCluster));
    return picked;
}
Also used : HostResource(com.yahoo.vespa.model.HostResource) ArrayList(java.util.ArrayList) ContainerModel(com.yahoo.vespa.model.container.ContainerModel)

Example 5 with HostResource

use of com.yahoo.vespa.model.HostResource in project vespa by vespa-engine.

the class ContainerModelBuilder method createNodesFromHosts.

private List<Container> createNodesFromHosts(Map<HostResource, ClusterMembership> hosts, ContainerCluster cluster) {
    List<Container> nodes = new ArrayList<>();
    for (Map.Entry<HostResource, ClusterMembership> entry : hosts.entrySet()) {
        String id = "container." + entry.getValue().index();
        Container container = new Container(cluster, id, entry.getValue().retired(), entry.getValue().index());
        container.setHostResource(entry.getKey());
        container.initService();
        nodes.add(container);
    }
    return nodes;
}
Also used : HostResource(com.yahoo.vespa.model.HostResource) Container(com.yahoo.vespa.model.container.Container) ClusterMembership(com.yahoo.config.provision.ClusterMembership) ArrayList(java.util.ArrayList) Map(java.util.Map)

Aggregations

HostResource (com.yahoo.vespa.model.HostResource)25 Test (org.junit.Test)10 ClusterMembership (com.yahoo.config.provision.ClusterMembership)6 Host (com.yahoo.vespa.model.Host)6 VespaModel (com.yahoo.vespa.model.VespaModel)6 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)5 ModelElement (com.yahoo.vespa.model.builder.xml.dom.ModelElement)4 ArrayList (java.util.ArrayList)4 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)3 MockRoot (com.yahoo.config.model.test.MockRoot)3 ContentSearchCluster (com.yahoo.vespa.model.content.ContentSearchCluster)3 Matchers.containsString (org.hamcrest.Matchers.containsString)3 Element (org.w3c.dom.Element)3 HostSystem (com.yahoo.vespa.model.HostSystem)2 ClusterControllerContainer (com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerContainer)2 NodesSpecification (com.yahoo.vespa.model.builder.xml.dom.NodesSpecification)2 Container (com.yahoo.vespa.model.container.Container)2 ProtonEngine (com.yahoo.vespa.model.content.engines.ProtonEngine)2 NodeSpec (com.yahoo.vespa.model.search.NodeSpec)2 SearchNode (com.yahoo.vespa.model.search.SearchNode)2