实验环境
- 服务器:京东云,1核2G
- 系统:centos7.3 64bit
安装docker
关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
关闭selinux
setenforce 0
修改/etc/selinux/config文件的SELINUX=XXX
vi /etc/selinux/config
SELINUX=disabled
安装docker
yum install epel-release -y
yum install -y docker
systemctl enable docker
启动
systemctl start docker.service
安装zookeeper
先执行下面命令安装
rpm -Uvh http://repos.mesosphere.io/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-mesosphere
yum install mesosphere-zookeeper -y
配置zookeeper
# 改成自己的内网ip
HOST_IP=192.168.1.105
echo 1 > /var/lib/zookeeper/myid
echo "server.1=${HOST_IP}:2888:3888" >> /etc/zookeeper/conf/zoo.cfg
启动zookeeper
systemctl start zookeeper
配置mesos master
安装
rpm -Uvh http://repos.mesosphere.io/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-mesosphere
yum install mesos -y
配置
# 改成自己的zookeeper的ip
HOST_IP=192.168.1.105
echo "zk://${HOST_IP}:2181/mesos" > /etc/mesos/zk
echo "${HOST_IP}" > /etc/mesos-master/hostname
启动
systemctl start mesos-master
配置mesos slave
安装
rpm -Uvh http://repos.mesosphere.io/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-mesosphere
yum install mesos -y
配置
# 改成自己的zookeeper的ip
HOST_IP=192.168.1.105
echo "zk://${HOST_IP}:2181/mesos" > /etc/mesos/zk
echo 'docker,mesos' > /etc/mesos-slave/containerizers
echo '5mins' > /etc/mesos-slave/executor_registration_timeout
# 改成本机IP
HOST_IP=192.168.1.105
echo "${HOST_IP}" > /etc/mesos-slave/hostname
启动
systemctl start mesos-slave
配置marathon
安装
rpm -Uvh http://repos.mesosphere.io/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-mesosphere
yum install marathon -y
配置
安装在mesos的master节点即可
启动
systemctl start marathon
marthon应用绑定域名
安装marathon-lb
docker run -d --restart=always --name marathon-lb --privileged -e PORTS=9090 --net=host ccr.ccs.tencentyun.com/mesos/marathon-lb:v1.11.1 sse -m http://192.168.0.105:8080 --group external
创建应用的时候加上两个label
HAPROXY_GROUP=external
HAPROXY_0_VHOST=你的域名
注意
打开 http://你的IP:5050 即可看到mesos的web版控制台
打开 http://你的IP:8080 即可看到marthon的web版控制台
由于这样子配置免密码可以访问,所以不能直接如此放到生产环境
文章首发于:http://blog.yubangweb.com/centos7-an-zhuang-mesos-marathon/ ,转发需表明来源
网友评论