Search in sources :

Example 1 with Container

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

the class ClusterControllerCluster method getConfig.

@Override
public void getConfig(ZookeepersConfig.Builder builder) {
    Collection<String> controllerHosts = new ArrayList<>();
    for (Container container : containerCluster.getContainers()) {
        controllerHosts.add(container.getHostName() + ":" + ZK_CLIENT_PORT);
    }
    builder.zookeeperserverlist(Joiner.on(",").join(controllerHosts));
}
Also used : Container(com.yahoo.vespa.model.container.Container) ArrayList(java.util.ArrayList)

Example 2 with Container

use of com.yahoo.vespa.model.container.Container 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 3 with Container

use of com.yahoo.vespa.model.container.Container 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)

Example 4 with Container

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

the class ContainerModelBuilder method addNodesFromXml.

private void addNodesFromXml(ContainerCluster cluster, Element containerElement, ConfigModelContext context) {
    Element nodesElement = XML.getChild(containerElement, "nodes");
    if (nodesElement == null) {
        // default single node on localhost
        Container node = new Container(cluster, "container.0", 0);
        HostResource host = allocateSingleNodeHost(cluster, log, containerElement, context);
        node.setHostResource(host);
        if (// TODO: Fold this into initService
        !node.isInitialized())
            node.initService();
        cluster.addContainers(Collections.singleton(node));
    } else {
        List<Container> nodes = createNodes(cluster, nodesElement, context);
        applyNodesTagJvmArgs(nodes, nodesElement.getAttribute(VespaDomBuilder.JVMARGS_ATTRIB_NAME));
        applyRoutingAliasProperties(nodes, cluster);
        applyDefaultPreload(nodes, nodesElement);
        applyMemoryPercentage(cluster, nodesElement.getAttribute(VespaDomBuilder.Allocated_MEMORY_ATTRIB_NAME));
        if (useCpuSocketAffinity(nodesElement))
            AbstractService.distributeCpuSocketAffinity(nodes);
        cluster.addContainers(nodes);
    }
}
Also used : HostResource(com.yahoo.vespa.model.HostResource) Container(com.yahoo.vespa.model.container.Container) ModelElement(com.yahoo.vespa.model.builder.xml.dom.ModelElement) Element(org.w3c.dom.Element)

Example 5 with Container

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

the class ContainerModelBuilder method createNodesFromNodeList.

private List<Container> createNodesFromNodeList(ContainerCluster cluster, Element nodesElement) {
    List<Container> nodes = new ArrayList<>();
    int nodeIndex = 0;
    for (Element nodeElem : XML.getChildren(nodesElement, "node")) {
        nodes.add(new ContainerServiceBuilder("container." + nodeIndex, nodeIndex).build(cluster, nodeElem));
        nodeIndex++;
    }
    return nodes;
}
Also used : Container(com.yahoo.vespa.model.container.Container) ModelElement(com.yahoo.vespa.model.builder.xml.dom.ModelElement) Element(org.w3c.dom.Element) ArrayList(java.util.ArrayList)

Aggregations

Container (com.yahoo.vespa.model.container.Container)16 Test (org.junit.Test)7 ArrayList (java.util.ArrayList)4 Element (org.w3c.dom.Element)4 Path (java.nio.file.Path)3 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)2 HostResource (com.yahoo.vespa.model.HostResource)2 VespaModel (com.yahoo.vespa.model.VespaModel)2 ModelElement (com.yahoo.vespa.model.builder.xml.dom.ModelElement)2 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)2 ZookeeperServerConfig (com.yahoo.cloud.config.ZookeeperServerConfig)1 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)1 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)1 ClusterMembership (com.yahoo.config.provision.ClusterMembership)1 ClusterControllerCluster (com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerCluster)1 ClusterControllerClusterVerifier (com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerClusterVerifier)1 ClusterControllerContainer (com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerContainer)1 DocprocChain (com.yahoo.vespa.model.container.docproc.DocprocChain)1 DocumentProcessor (com.yahoo.vespa.model.container.docproc.DocumentProcessor)1 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)1