Rishabh Chaudhary
Integrating Docker with Mesos
and Marathon
2
Introduction to Mesos
 Distributed System's Kernel
 Cluster Manager
 Master-slave architecture
3
Features of Mesos:
 Scalability
 Fault tolerance
 Multi resource scheduling
 GUI
 Fine grained resource sharing
 Supports docker containers
4
Architecture
MASTER 3
SLAVE 1 SLAVE 2 SLAVE 3 SLAVE 4
MASTER 1 MASTER 2
ZOOKEEPER
5
Introduction to Marathon
 Application Scheduler
 Cluster wide process supervisor
 Scaling
 Long running applications
 Tolerant towards application failover
6
How do they work together?
7
Multi system environment:
8
Marathon: Features
 HA: how?
 Run multiple instances
 Automatic selection of leader
 Requests to non-leader gets redirected to the leader
 Run other frameworks through Marathon
 REST API and GUI
9
Architecture : Revised 1
MASTER 3
SLAVE 1 SLAVE 2 SLAVE 3 SLAVE 4
MASTER 1 MASTER 2
ZOOKEEPER
MARATHON
SCHEDULER 2
10
Architecture : Revised 2
MASTER 3
SLAVE 1 SLAVE 2 SLAVE 3 SLAVE 4
MASTER 1 MASTER 2
ZOOKEEPER
MARATHON
SCHEDULER 1
MARATHON
SCHEDULER 2
11
The list goes on..
12
Docker with Mesos and Marathon
 Mesos supports containers:
 Mesos Containers
 Docker Containers
 Long Running Tasks on Marathon
 JSON Scripts
 Marathon’s REST API
13
Points to note:
 Not all tasks must be containerized
 Non containerized tasks are also supported in Marathon
 Tasks that should be run within a docker container must be configured to do so:
 Use JSON scripts for task configuration
 Use Marathon’s REST API to post the containerized application
14
Sample JSON:
{
"container": {
"type": "DOCKER",
"docker": {
"image": "autoscale",
"network": "BRIDGE"
}
},
"id": "relay",
"instances": 1,
"cpus": 0.5,
"mem": 512,
"uris": []
}
15
Sample JSON 2:
{
"container": {
"type": "DOCKER",
"docker": {
"image": "loadcheck",
"network": "BRIDGE",
"portMappings": [
{ "containerPort":8080, "hostPort":0}
]
}
},
"env": {
"HOST_IP":"172.16.12.247:3306"
},
"id": "webapp",
"instances": 1,
"cpus": 0.5,
"mem": 512,
"cmd": "./bin/startup.sh && tail -f ./logs/catalina.out"
}
16
Tomcat
Server 1
Tomcat
Server 2
Tomcat
Server N
Load
Balancer
DatabaseClient
Deployment example:
17
Questions?

Integrating Docker with Mesos and Marathon

  • 1.
    Rishabh Chaudhary Integrating Dockerwith Mesos and Marathon
  • 2.
    2 Introduction to Mesos Distributed System's Kernel  Cluster Manager  Master-slave architecture
  • 3.
    3 Features of Mesos: Scalability  Fault tolerance  Multi resource scheduling  GUI  Fine grained resource sharing  Supports docker containers
  • 4.
    4 Architecture MASTER 3 SLAVE 1SLAVE 2 SLAVE 3 SLAVE 4 MASTER 1 MASTER 2 ZOOKEEPER
  • 5.
    5 Introduction to Marathon Application Scheduler  Cluster wide process supervisor  Scaling  Long running applications  Tolerant towards application failover
  • 6.
    6 How do theywork together?
  • 7.
  • 8.
    8 Marathon: Features  HA:how?  Run multiple instances  Automatic selection of leader  Requests to non-leader gets redirected to the leader  Run other frameworks through Marathon  REST API and GUI
  • 9.
    9 Architecture : Revised1 MASTER 3 SLAVE 1 SLAVE 2 SLAVE 3 SLAVE 4 MASTER 1 MASTER 2 ZOOKEEPER MARATHON SCHEDULER 2
  • 10.
    10 Architecture : Revised2 MASTER 3 SLAVE 1 SLAVE 2 SLAVE 3 SLAVE 4 MASTER 1 MASTER 2 ZOOKEEPER MARATHON SCHEDULER 1 MARATHON SCHEDULER 2
  • 11.
  • 12.
    12 Docker with Mesosand Marathon  Mesos supports containers:  Mesos Containers  Docker Containers  Long Running Tasks on Marathon  JSON Scripts  Marathon’s REST API
  • 13.
    13 Points to note: Not all tasks must be containerized  Non containerized tasks are also supported in Marathon  Tasks that should be run within a docker container must be configured to do so:  Use JSON scripts for task configuration  Use Marathon’s REST API to post the containerized application
  • 14.
    14 Sample JSON: { "container": { "type":"DOCKER", "docker": { "image": "autoscale", "network": "BRIDGE" } }, "id": "relay", "instances": 1, "cpus": 0.5, "mem": 512, "uris": [] }
  • 15.
    15 Sample JSON 2: { "container":{ "type": "DOCKER", "docker": { "image": "loadcheck", "network": "BRIDGE", "portMappings": [ { "containerPort":8080, "hostPort":0} ] } }, "env": { "HOST_IP":"172.16.12.247:3306" }, "id": "webapp", "instances": 1, "cpus": 0.5, "mem": 512, "cmd": "./bin/startup.sh && tail -f ./logs/catalina.out" }
  • 16.
    16 Tomcat Server 1 Tomcat Server 2 Tomcat ServerN Load Balancer DatabaseClient Deployment example:
  • 17.