Coder Social home page Coder Social logo

single-docker-mesos's Introduction

xianlubird/single-docker-mesos

基于Docker快速搭建单节点Mesos/Marathon集群,增加支持marathon管理运行docker功能

##一. 简介

Mesos是集群资源管理系统,Marathon是运行在Mesos之上的集群计算架构。将Mesos和Marathon打包到Docker镜像中,开发者便可以在本机上快速搭建Mesos/Marathon集群,进行学习和测试。

kiwenlau/single-mesos镜像非常简单。Docker容器运行在Ubuntu主机之上,Mesos和Marathon运行在该容器之中。具体来讲,Docker容器中运行了一个Mesos Master和一个Mesos Slave,以及Marathon和ZooKeeper。集群架构如下图:

##二. 搭建Mesos/Marathon集群

1. 下载Docker镜像:

docker pull index.alauda.cn/a352193394/single-docker-mesos

2. 运行Docker容器:

docker run -p 8080:8080 -p 5050:5050 --name mesos -ti -w /root -v /sys/fs/cgroup:/sys/fs/cgroup -v /var/run/docker.sock:/var/run/docker.sock single-docker-mesos

docker run命令运行成功后即进入容器内部,以下为输出:

Start ZooKeeper...
Start Mesos master...
Start Mesos slave...
Start Marathon...

##三. 测试Mesos/Marathon集群

1. 通过curl命令调用Marathon的REST API, 创建一个hello程序:

curl -v -H "Content-Type: application/json" -X POST --data "@hello.json" http://127.0.0.1:8080/v2/apps

下面为hello.json。这个程序使用docker运行了一个简单的python服务。

{
  "id": "basic-3",
  "cmd": "python3 -m http.server 8080",
  "cpus": 0.5,
  "mem": 32.0,
  "container": {
    "type": "DOCKER",
    "docker": {
      "image": "python:3",
      "network": "BRIDGE",
      "portMappings": [
        { "containerPort": 8080, "hostPort": 0 }
      ]
    }
  }
}

single-docker-mesos's People

Contributors

xianlubird avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.