我github项目上的说明
本人语死早,请谅解我的语言组织能力
如何使mesosphere
docker集群支持服务发现
CentOS 7
yum update -y
yum install bash curl wget tar zip unzip bzip2 telnet net-tools git -y
yum groupinstall "Development Tools" –y
yum -y install ntp ntpdate
systemctl start ntpd
如果需要的话关闭防火墙
setenforce Permissive
systemctl stop firewalld
systemctl disable firewalld
添加yum源
rpm -Uvh 'http://repos.mesosphere.io/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm'
rpm -Uvh 'http://archive.cloudera.com/cdh4/one-click-install/redhat/6/x86_64/cloudera-cdh-4-0.x86_64.rpm'
yum -y install mesos marathon mesosphere-zookeeper
> haproxy只有master节点才需要
yum -y install haproxy && systemctl start haproxy
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install -y docker
systemctl disable mesos-master
systemctl disable mesos-slave
systemctl disable marathon
systemctl disable zookeeper
> 只有master 节点需要如此操作
设置文件[/var/lib/zookeeper/myid]为当前mesos master节点的id,id必须为1-255之中的整数,例如:1
添加所有的mesos master节点信息到文件[/etc/zookeeper/conf/zoo.cf],例如:
master_node_id为master节点id同该节点[/var/lib/zookeeper/myid]文件的配置,master_node_ip为master节点的ip地址
server.$master_node_id=$master_node_ip:2888:3888
启动zookeeper
systemctl start zookeeper
> master和slave节点都需要如此设置
添加所有的master节点到文件[/etc/mesos/zk],例如:
zk://$first_master_node_ip:2181,$second_master_node_ip:2181,.../mesos
> 只有master节点需要如此配置,marathon节点与master节点不同,目前我是把marathon安装在master节点
设置文件[/etc/mesos-master/quorum]内容为一个大于master节点数除以2的整数
设置文件[/etc/mesos-master/ip]内容为当前master节点的ip
设置文件[/etc/mesos-master/hostname]内容为当前master节点的域名(必须可被其他节点解析)
mkdir -p /etc/marathon/conf
cp /etc/mesos/zk /etc/marathon/conf/master
cp /etc/marathon/conf/master /etc/marathon/conf/zk
sed –i 's|mesos|marathon|g' /etc/marathon/conf/zk
> 安装在master节点
因为官方推荐的脚本和Haproxy1.5不兼容所以请使用我的脚本
wget 'https://github.com/draculavlad/SetUpMesosphereOnCentos7/blob/master/haproxy-marathon-bridge'
设置文件[/etc/haproxy-marathon-bridge/marathons]:
echo "$first_marathon_node_ip:8080" >> /etc/haproxy-marathon-bridge/marathons
echo "$second_marathon_node_ip:8080" >> /etc/haproxy-marathon-bridge/marathons
echo "$third_marathon_node_ip:8080" >> /etc/haproxy-marathon-bridge/marathons
执行安装脚本
chmod +x haproxy-marathon-bridge
./haproxy-marathon-bridge install_cronjob
systemctl start mesos-master
systemctl start marathon
设置文件[/etc/mesos-slave/ip]内容为当前slave节点的ip地址
设置文件[/etc/mesos-slave/hostname]内容为当前slave节点的域名(必须可被其他节点解析)
使slave节点支持docker
echo 'docker,mesos' > /etc/mesos-slave/containerizers
echo '5mins' > /etc/mesos-slave/executor_registration_timeout
启动mesos slave
systemctl start mesos-slave
>测试脚本来自于我参考的youtube视频
wget 'https://github.com/draculavlad/SetUpMesosphereOnCentos7WithServiceDiscovery/blob/master/launch.sh'
wget 'https://github.com/draculavlad/SetUpMesosphereOnCentos7WithServiceDiscovery/blob/master/nginx-bridge.json'
export marathon_node_ip=$your_marathon_node_ip
chmod +x launch.sh
./launch.sh nginx-bridge.json