Example #1
0
func gatherArgs(c *etcd.Client) []string {
	var args []string

	nodes := etcd.GetList(c, "/zookeeper/nodes")
	var hosts []string
	for _, node := range nodes {
		hosts = append(hosts, node+":3888")
	}
	zkHosts := strings.Join(hosts, ",")
	args = append(args, "--master=zk://"+zkHosts+"/mesos")
	args = append(args, "--containerizers=docker,mesos")

	return args
}
Example #2
0
func gatherArgs(c *etcd.Client) []string {
	var args []string

	nodes := etcd.GetList(c, "/zookeeper/nodes")
	var hosts []string
	for _, node := range nodes {
		hosts = append(hosts, node+":3888")
	}
	zkHosts := strings.Join(hosts, ",")
	args = append(args, "--zk=zk://"+zkHosts+"/mesos")
	args = append(args, "--quorum=1")
	args = append(args, "--work_dir=/tmp/mesos-master")

	return args
}
Example #3
0
// CheckZkMappingInFleet verifies if there is a mapping for each node in
// the CoreOS cluster using the metadata zookeeper=true to filter wich
// nodes zookeeper should run
func CheckZkMappingInFleet(etcdPath string, etcdClient *etcd.Client, etcdURL []string) {
	// check if the nodes with the required role already have the an id.
	// If not get fleet nodes with the required role and preassing the
	// ids for every node in the cluster
	err := etcd.AcquireLock(etcdClient, etcdLock, 10)
	if err != nil {
		panic(err)
	}

	zkNodes := etcd.GetList(etcdClient, etcdPath)
	log.Debugf("zookeeper nodes %v", zkNodes)

	machines, err := getMachines(etcdURL)
	if err != nil {
		panic(err)
	}
	log.Debugf("machines %v", machines)

	if len(machines) == 0 {
		log.Warning("")
		log.Warning("there is no machine using metadata zookeeper=true in the cluster to run zookeeper")
		log.Warning("we will create the mapping with for all the nodes")
		log.Warning("")
		machines = fleet.GetNodesInCluster(etcdURL)
	}

	if len(zkNodes) == 0 {
		log.Debug("initializing zookeeper cluster")
		for index, newZkNode := range machines {
			log.Debug("adding node %v to zookeeper cluster", newZkNode)
			etcd.Set(etcdClient, etcdPath+"/"+newZkNode+"/id", strconv.Itoa(index+1), 0)
		}
	} else {
		// we check if some machine in the fleet cluster with the
		// required role is not initialized (no zookeeper node id).
		machinesNotInitialized := difference(machines, zkNodes)
		if len(machinesNotInitialized) > 0 {
			nextNodeID := getNextNodeID(etcdPath, etcdClient, zkNodes)
			for _, zkNode := range machinesNotInitialized {
				etcd.Set(etcdClient, etcdPath+"/"+zkNode+"/id", strconv.Itoa(nextNodeID), 0)
				nextNodeID++
			}
		}
	}

	// release the etcd lock
	etcd.ReleaseLock(etcdClient)
}
Example #4
0
func gatherArgs(c *etcd.Client) []string {
	var args []string

	nodes := etcd.GetList(c, "/zookeeper/nodes")
	var hosts []string
	for _, node := range nodes {
		hosts = append(hosts, node+":3888")
	}
	zkHosts := strings.Join(hosts, ",")
	args = append(args, "--master", "zk://"+zkHosts+"/mesos")
	args = append(args, "--zk", "zk://"+zkHosts+"/marathon")
	// 20min task launch timeout for large docker image pulls
	args = append(args, "--task_launch_timeout", "1200000")
	args = append(args, "--ha")
	args = append(args, "--http_port", "8180")

	return args
}