Search in sources :

Example 1 with ContainerCluster

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

the class DomAdminV2Builder method addConfiguredClusterControllers.

private ContainerCluster addConfiguredClusterControllers(AbstractConfigProducer parent, Element admin) {
    Element controllersElements = XML.getChild(admin, "cluster-controllers");
    if (controllersElements == null)
        return null;
    List<Element> controllers = XML.getChildren(controllersElements, "cluster-controller");
    if (controllers.isEmpty())
        return null;
    boolean standaloneZooKeeper = "true".equals(controllersElements.getAttribute(ATTRIBUTE_CLUSTER_CONTROLLER_STANDALONE_ZK)) || multitenant;
    if (standaloneZooKeeper) {
        parent = new ClusterControllerCluster(parent, "standalone");
    }
    ContainerCluster cluster = new ContainerCluster(parent, "cluster-controllers", "cluster-controllers", new ClusterControllerClusterVerifier());
    ContainerModelBuilder.addDefaultHandler_legacyBuilder(cluster);
    List<Container> containers = new ArrayList<>();
    for (Element controller : controllers) {
        ClusterControllerContainer clusterController = new ClusterControllerBuilder(containers.size(), standaloneZooKeeper).build(cluster, controller);
        containers.add(clusterController);
    }
    cluster.addContainers(containers);
    return cluster;
}
Also used : ClusterControllerContainer(com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerContainer) Container(com.yahoo.vespa.model.container.Container) ClusterControllerContainer(com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerContainer) Element(org.w3c.dom.Element) ArrayList(java.util.ArrayList) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ClusterControllerClusterVerifier(com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerClusterVerifier) ClusterControllerCluster(com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerCluster)

Example 2 with ContainerCluster

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

the class ClusterSizeReductionValidator method validate.

@Override
public List<ConfigChangeAction> validate(VespaModel current, VespaModel next, ValidationOverrides overrides, Instant now) {
    for (ContainerCluster currentCluster : current.getContainerClusters().values()) {
        ContainerCluster nextCluster = next.getContainerClusters().get(currentCluster.getName());
        if (nextCluster == null)
            continue;
        validate(currentCluster.getContainers().size(), nextCluster.getContainers().size(), currentCluster.getName(), overrides, now);
    }
    for (ContentCluster currentCluster : current.getContentClusters().values()) {
        ContentCluster nextCluster = next.getContentClusters().get(currentCluster.getName());
        if (nextCluster == null)
            continue;
        validate(currentCluster.getSearch().getSearchNodes().size(), nextCluster.getSearch().getSearchNodes().size(), currentCluster.getName(), overrides, now);
    }
    return Collections.emptyList();
}
Also used : ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster)

Example 3 with ContainerCluster

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

the class Content method createTlds.

public void createTlds(ConfigModelRepo modelRepo) {
    IndexedSearchCluster indexedCluster = cluster.getSearch().getIndexed();
    if (indexedCluster == null)
        return;
    SimpleConfigProducer tldParent = new SimpleConfigProducer(indexedCluster, "tlds");
    for (ConfigModel model : modelRepo.asMap().values()) {
        if (!(model instanceof ContainerModel))
            continue;
        ContainerCluster containerCluster = ((ContainerModel) model).getCluster();
        // this is not a qrs cluster
        if (containerCluster.getSearch() == null)
            continue;
        log.log(LogLevel.DEBUG, "Adding tlds for indexed cluster " + indexedCluster.getClusterName() + ", container cluster " + containerCluster.getName());
        indexedCluster.addTldsWithSameIdsAsContainers(tldParent, containerCluster);
    }
    indexedCluster.setupDispatchGroups();
}
Also used : IndexedSearchCluster(com.yahoo.vespa.model.search.IndexedSearchCluster) ConfigModel(com.yahoo.config.model.ConfigModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ContainerModel(com.yahoo.vespa.model.container.ContainerModel)

Example 4 with ContainerCluster

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

the class ContainerModelBuilder method doBuild.

@Override
public void doBuild(ContainerModel model, Element spec, ConfigModelContext modelContext) {
    app = modelContext.getApplicationPackage();
    checkVersion(spec);
    this.log = modelContext.getDeployLogger();
    ContainerCluster cluster = createContainerCluster(spec, modelContext);
    addClusterContent(cluster, spec, modelContext);
    addBundlesForPlatformComponents(cluster);
    model.setCluster(cluster);
}
Also used : ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster)

Example 5 with ContainerCluster

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

the class ModelProvisioningTest method testUsingNodesAndGroupCountAttributesAndGettingJustOneNode.

@Test
public void testUsingNodesAndGroupCountAttributesAndGettingJustOneNode() throws ParseException {
    String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + "  <admin version='3.0'>" + // Ignored
    "    <nodes count='3'/>" + "  </admin>" + "  <content version='1.0' id='bar'>" + "     <redundancy reply-after='3'>4</redundancy>" + "     <documents>" + "       <document type='type1' mode='index'/>" + "     </documents>" + "     <nodes count='24' groups='3'/>" + "     <engine><proton><searchable-copies>3</searchable-copies></proton></engine>" + "  </content>" + "</services>";
    // We only have 1 content node -> 1 groups with redundancy 1
    int numberOfHosts = 1;
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts(numberOfHosts);
    VespaModel model = tester.createModel(services, false);
    assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
    ContentCluster cluster = model.getContentClusters().get("bar");
    ContainerCluster clusterControllers = cluster.getClusterControllers();
    assertEquals(1, clusterControllers.getContainers().size());
    assertEquals("bar-controllers", clusterControllers.getName());
    assertEquals("default01", clusterControllers.getContainers().get(0).getHostName());
    // Reduced from 3*3
    assertEquals(1, cluster.redundancy().effectiveInitialRedundancy());
    // Reduced from 3*4
    assertEquals(1, cluster.redundancy().effectiveFinalRedundancy());
    // Reduced from 3*3
    assertEquals(1, cluster.redundancy().effectiveReadyCopies());
    // 1 group - > flattened -> no distribution
    assertFalse(cluster.getRootGroup().getPartitions().isPresent());
    assertEquals(1, cluster.getRootGroup().getNodes().size());
    assertEquals(0, cluster.getRootGroup().getSubgroups().size());
    assertThat(cluster.getRootGroup().getNodes().size(), is(1));
    assertThat(cluster.getRootGroup().getNodes().get(0).getDistributionKey(), is(0));
    assertThat(cluster.getRootGroup().getNodes().get(0).getConfigId(), is("bar/storage/0"));
}
Also used : VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Aggregations

ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)42 Test (org.junit.Test)28 VespaModel (com.yahoo.vespa.model.VespaModel)22 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)16 VespaModelTester (com.yahoo.vespa.model.test.VespaModelTester)11 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)10 Element (org.w3c.dom.Element)6 Component (com.yahoo.vespa.model.container.component.Component)4 ComponentId (com.yahoo.component.ComponentId)3 ContainerModel (com.yahoo.vespa.model.container.ContainerModel)3 VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)3 Matchers.containsString (org.hamcrest.Matchers.containsString)3 DeployState (com.yahoo.config.model.deploy.DeployState)2 Container (com.yahoo.vespa.model.container.Container)2 ContainerDocproc (com.yahoo.vespa.model.container.docproc.ContainerDocproc)2 JettyHttpServer (com.yahoo.vespa.model.container.http.JettyHttpServer)2 DeploymentSpec (com.yahoo.config.application.api.DeploymentSpec)1 ConfigModel (com.yahoo.config.model.ConfigModel)1 MockRoot (com.yahoo.config.model.test.MockRoot)1 Zone (com.yahoo.config.provision.Zone)1