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));
}
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;
}
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;
}
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);
}
}
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;
}
Aggregations