mesos

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2015 License: Apache-2.0 Imports: 23 Imported by: 0

README

Using Docker Swarm and Mesos

Swarm comes with a built-in scheduler that works with the swarm manager to schedule container resources. You can completely replace the built-in scheduler with a 3rd party scheduler. For example, you can replace it with the Mesos scheduler as described here.

When using Docker Swarm and Mesos, you use the Docker client to ask the swarm manager to schedule containers. The swarm manager then schedules those containers on a Mesos cluster.

Prerequisites

Each node in your swarm must run a Mesos slave. The slave must be capable of starting tasks in a Docker Container using the --containerizers=docker option.

You need to configure two TCP ports on the slave. One port to listen for the swarm manager, for example 2375. And a second TCP port to listen for the Mesos master, for example 3375.

Start the Docker Swarm manager

If you use a single Mesos master:

$ docker run -d -p <swarm_port>:2375 -p 3375:3375 \
    swarm manage \
        -c mesos-experimental \
        --cluster-opt mesos.address=<public_machine_ip> \
        --cluster-opt mesos.port=3375 \
        <mesos_master_ip>:<mesos_master:port>

The command above creates a swarm manager listening at <swarm_port>. The <mesos_master_ip> value points to where Mesos master lives in the cluster. Typically, this is localhost, a hostname, or an IP address. The <public_machine_ip> value is the IP address for Mesos master to talk to swarm manager. If mesos master and swarm manager are co-located on the same machine, you can use the 0.0.0.0 or localhost value.

If you use multiple Mesos masters:

$ docker run -d -p <swarm_port>:2375 -p 3375:3375 \
    swarm manage \
        -c mesos-experimental \
        --cluster-opt mesos.address=<public_machine_ip> \
        --cluster-opt mesos.port=3375 \
        zk://<mesos_masters_url>

Once the manager is running, check your configuration by running docker info as follows:

$ docker -H tcp://<swarm_ip>:<swarm_port> info
Containers: 0
Offers: 2
  Offer: 20150609-222929-1327399946-5050-14390-O6286
     └ cpus: 2
     └ mem: 1006 MiB
     └ disk: 34.37 GiB
     └ ports: 31000-32000
  Offer: 20150609-222929-1327399946-5050-14390-O6287
     └ cpus: 2
     └ mem: 1006 MiB
     └ disk: 34.37 GiB
     └ ports: 31000-32000

If you run into Abnormal executor termination error, you might want to run the swarm container with an additional environment variable: SWARM_MESOS_USER=root.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCluster

func NewCluster(scheduler *scheduler.Scheduler, TLSConfig *tls.Config, master string, options cluster.DriverOpts) (cluster.Cluster, error)

NewCluster for mesos Cluster creation

Types

type Cluster

type Cluster struct {
	sync.RWMutex

	TLSConfig *tls.Config
	// contains filtered or unexported fields
}

Cluster struct for mesos

func (*Cluster) BuildImage added in v0.4.0

func (c *Cluster) BuildImage(buildImage *dockerclient.BuildImage, out io.Writer) error

BuildImage build an image

func (*Cluster) Container

func (c *Cluster) Container(IDOrName string) *cluster.Container

Container returns the container with IdOrName in the cluster

func (*Cluster) Containers

func (c *Cluster) Containers() cluster.Containers

Containers returns all the containers in the cluster.

func (*Cluster) CreateContainer

func (c *Cluster) CreateContainer(config *cluster.ContainerConfig, name string) (*cluster.Container, error)

CreateContainer for container creation in Mesos task

func (*Cluster) CreateNetwork added in v1.0.0

CreateNetwork creates a network in the cluster

func (*Cluster) CreateVolume added in v1.0.0

func (c *Cluster) CreateVolume(request *dockerclient.VolumeCreateRequest) (*cluster.Volume, error)

CreateVolume creates a volume in the cluster

func (*Cluster) Disconnected

func (c *Cluster) Disconnected(mesosscheduler.SchedulerDriver)

Disconnected method

func (*Cluster) Error

func (c *Cluster) Error(d mesosscheduler.SchedulerDriver, msg string)

Error method

func (*Cluster) ExecutorLost

ExecutorLost method

func (*Cluster) FrameworkMessage

FrameworkMessage method

func (*Cluster) Handle added in v0.4.0

func (c *Cluster) Handle(e *cluster.Event) error

Handle callbacks for the events

func (*Cluster) Image

func (c *Cluster) Image(IDOrName string) *cluster.Image

Image returns an image with IdOrName in the cluster

func (*Cluster) Images

func (c *Cluster) Images() cluster.Images

Images returns all the images in the cluster.

func (*Cluster) Import

func (c *Cluster) Import(source string, repository string, tag string, imageReader io.Reader, callback func(what, status string, err error))

Import image

func (*Cluster) Info

func (c *Cluster) Info() [][]string

Info gives minimal information about containers and resources on the mesos cluster

func (*Cluster) Load

func (c *Cluster) Load(imageReader io.Reader, callback func(where, status string, err error))

Load images

func (*Cluster) Networks added in v1.0.0

func (c *Cluster) Networks() cluster.Networks

Networks returns all the networks in the cluster.

func (*Cluster) OfferRescinded

OfferRescinded method

func (*Cluster) Pull

func (c *Cluster) Pull(name string, authConfig *dockerclient.AuthConfig, callback func(where, status string, err error))

Pull will pull images on the cluster nodes

func (*Cluster) RANDOMENGINE

func (c *Cluster) RANDOMENGINE() (*cluster.Engine, error)

RANDOMENGINE returns a random engine.

func (*Cluster) RegisterEventHandler

func (c *Cluster) RegisterEventHandler(h cluster.EventHandler) error

RegisterEventHandler registers an event handler.

func (*Cluster) Registered

func (c *Cluster) Registered(driver mesosscheduler.SchedulerDriver, fwID *mesosproto.FrameworkID, masterInfo *mesosproto.MasterInfo)

Registered method for registered mesos framework

func (*Cluster) RemoveContainer

func (c *Cluster) RemoveContainer(container *cluster.Container, force, volumes bool) error

RemoveContainer to remove containers on mesos cluster

func (*Cluster) RemoveImage

func (c *Cluster) RemoveImage(image *cluster.Image) ([]*dockerclient.ImageDelete, error)

RemoveImage removes an image from the cluster

func (*Cluster) RemoveImages

func (c *Cluster) RemoveImages(name string, force bool) ([]*dockerclient.ImageDelete, error)

RemoveImages removes images from the cluster

func (*Cluster) RemoveNetwork added in v1.0.0

func (c *Cluster) RemoveNetwork(network *cluster.Network) error

RemoveNetwork removes network from the cluster

func (*Cluster) RemoveVolumes added in v1.0.0

func (c *Cluster) RemoveVolumes(name string) (bool, error)

RemoveVolumes removes volumes from the cluster

func (*Cluster) RenameContainer

func (c *Cluster) RenameContainer(container *cluster.Container, newName string) error

RenameContainer Rename a container

func (*Cluster) Reregistered

Reregistered method for registered mesos framework

func (*Cluster) ResourceOffers

func (c *Cluster) ResourceOffers(_ mesosscheduler.SchedulerDriver, offers []*mesosproto.Offer)

ResourceOffers method

func (*Cluster) SlaveLost

SlaveLost method

func (*Cluster) StatusUpdate

func (c *Cluster) StatusUpdate(_ mesosscheduler.SchedulerDriver, taskStatus *mesosproto.TaskStatus)

StatusUpdate method

func (*Cluster) TagImage added in v1.0.0

func (c *Cluster) TagImage(IDOrName string, repo string, tag string, force bool) error

TagImage tag an image

func (*Cluster) TotalCpus

func (c *Cluster) TotalCpus() int64

TotalCpus return the total memory of the cluster

func (*Cluster) TotalMemory

func (c *Cluster) TotalMemory() int64

TotalMemory return the total memory of the cluster

func (*Cluster) Volume added in v1.0.0

func (c *Cluster) Volume(name string) *cluster.Volume

Volume returns the volume name in the cluster

func (*Cluster) Volumes added in v1.0.0

func (c *Cluster) Volumes() []*cluster.Volume

Volumes returns all the volumes in the cluster.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL