Mesos, Marathon, Docker 平台部署记录

Mesos, Marathon, Docker 平台部署记录

所有组件部署基于Ubuntu 14.04 x64

主机 IP 角色
master 192.168.1.3 Mesos Master, Marathon
slave 192.168.1.2 Mesos Slave, Docker
zookeeper 192.168.1.4 Zookeeper

安装准备

  1. 所有机器自行安装JAVA8,而且导入环境变量
  2. 关闭防火墙
root@base:~# java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

zookeeper安装

sudo apt-get update
wget http://apache.fayea.com/zookeeper/zookeeper-3.4.8/zookeeper-3.4.8.tar.gz
tar -zxvf zookeeper-3.4.8.tar.gz
cd zookeeper-3.4.8/conf
cp zoo_sample.cfg zoo.cfg
cd ../bin
./zkServer.sh start

master, slave安装

sudo apt-get update
sudo apt-get install -y tar wget git autoconf
sudo apt-get install -y libtool install build-essential python-dev python-boto \
libcurl4-nss-dev libsasl2-dev libsasl2-modules maven libapr1-dev libsvn-dev

下载源代码

sudo git clone https://git-wip-us.apache.org/repos/asf/mesos.git

编译安装(make 使用-j參数来指定cpu 核数提高编译速度, V=0降低冗长日志输出)

# Change working directory.
$ cd mesos # Bootstrap (Only required if building from git repository).
$ ./bootstrap # Configure and build.
$ mkdir build
$ cd build
$ ../configure
$ make -j4 V=0
$ make check -j4 V=0
$ make install -j4 V=0

PS:编译时间因机器配置而异

启动Mesos

root@master:~/mesos/build# pwd
/root/mesos/build
root@master:~/mesos/build# nohup ./bin/mesos-master.sh -h 192.168.1.3 --ip=192.168.1.3 --work_dir=/var/lib/mesos --quorum=1 --zk=zk://192.168.1.4:2181 &
root@slave:~/mesos/build# pwd
/root/mesos/build
root@slave:~/mesos/build# nohup ./bin/mesos-slave.sh -h 192.168.1.2 --ip=192.168.1.2 --work_dir=/var/lib/mesos --containerizers=docker --master=zk://192.168.1.4:2181/mesos &

浏览器訪问 http://192.168.1.3:5050 就可以訪问Mesos

安装Marathon (Master 主机上)

curl -O http://downloads.mesosphere.com/marathon/v0.15.2/marathon-0.15.2.tgz
tar xzf marathon-0.15.2.tgz
cd marathoon-0.15.2
nohup ./bin/start --master zk://192.168.1.4:2181/mesos --zk zk://192.168.1.4:2181/marathon &

浏览器訪问 http://192.168.1.3:8080 就可以訪问Marathon FrameWork

安装Docker (Slave主机)

echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" >> /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get install docker-engine
service docker start

如今能够使用 Marathon来构建容器了

參考资料

http://mesos.apache.org/documentation/latest/getting-started/

https://mesosphere.github.io/marathon/docs/

上一篇:Docker网络解决方案 - Calico部署记录


下一篇:Docker网络解决方案 - Flannel部署记录