全部组件部署基于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 |
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)
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
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:编译时间因机器配置而异
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
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
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/