Mesos, Marathon, Docker 平台部署记录

江佐
2023-12-01

Mesos, Marathon, Docker 平台部署记录

全部组件部署基于Ubuntu 14.04 x64

主机IP角色
master192.168.1.3Mesos Master, Marathon
slave192.168.1.2Mesos Slave, Docker
zookeeper192.168.1.4Zookeeper

安装准备

  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/

 类似资料: