一侨歉、Mesos 簡介
二怪与、Mesos 集群安裝
1. 安裝環(huán)境
role | hostname | ip | release |
---|---|---|---|
master1 | sh-docker-master-01 | 1.1.1.100 | centos7.2 |
master2 | sh-docker-node-01 | 1.1.1.101 | centos7.2 |
master3 | sh-docker-node-02 | 1.1.1.102 | centos7.2 |
slave1 | bj-docker-node-01 | 1.1.1.103 | centos7.2 |
2 安裝Mesos Master
下面操作若未注明均在三臺主機(jī)操作
- 添加 mesos的yum源
rpm -Uvh http://repos.mesosphere.io/el/7/noarch/RPMS/mesosphere-el-repo-7-2.noarch.rpm
- 配置hosts
echo "1.1.1.100 master1" >>/etc/hosts
echo "1.1.1.101 master2" >>/etc/hosts
echo "1.1.1.102 master3" >>/etc/hosts
- 分別安裝 Mesos
yum -y install mesos marathon mesosphere-zookeeper
- 配置zookeeper
master1
touch /var/lib/zookeeper/myid
echo 1 > /var/lib/zookeeper/myid
master2
touch /var/lib/zookeeper/myid
echo 2 > /var/lib/zookeeper/myid
master3
touch /var/lib/zookeeper/myid
echo 3 > /var/lib/zookeeper/myid
master1,master2,master3在配置文件/etc/zookeeper/conf/zoo.cfg中加入下面內(nèi)容
echo "server.1=1.1.100:2888:3888">>/etc/zookeeper/conf/zoo.cfg
echo "server.1=1.1.101:2888:3888">>/etc/zookeeper/conf/zoo.cfg
echo "server.1=1.1.102:2888:3888">>/etc/zookeeper/conf/zoo.cfg
PORT1 因為三臺為高可用,肯定有個master写隶,這個端口是master起的盐肃;
PORT2 為他們互相檢查盒犹、看誰當(dāng)master檢查用的。
- 配置mesos
每個master節(jié)點的/etc/mesos/zk配置文件中設(shè)置zk的地址
echo "zk://1.1.1.100:2181,1.1.1.101:2181,1.1.1.102:2181/mesos">/etc/mesos/zk
/etc/mesos-master/quorum中設(shè)置quorum值 這個值要大于master數(shù)/2锌订,這里master數(shù)為3蟆炊,則要設(shè)為2
echo 2 > /etc/mesos-master/quorum
- 配置marathon
# 這里說下,我們把主機(jī)名master$num 寫進(jìn)hosts解析里面瀑志,然后把各自的主機(jī)名寫進(jìn)這個文件中
master
echo $hostname>/etc/mesos-master/hostname
mkdir -p /etc/marathon/conf/
cp /etc/mesos-master/hostname /etc/marathon/conf
zk
# 配置marathon自己的zk涩搓,另外還需要連接mesos自己的污秆,因為他要過去調(diào)度任務(wù)
cp /etc/mesos/zk /etc/marathon/conf/master
cp /etc/marathon/conf/master /etc/marathon/conf/zk
echo "zk://1.1.1.100:2181,1.1.1.101:2181,1.1.1.102:2181/marathon">/etc/marathon/conf/zk
- 啟動zookeeper mesos-master marathon
for server in zookeeper mesos-master marathon;do
systemctl start $server
done
systemctl disable mesos-slave
3. 安裝Mesos Slave
yum -y install mesos
- 配置master信息
echo "zk://1.1.1.100:2181,1.1.1.101:2181,1.1.1.102:2181/mesos">/etc/mesos/zk
echo $hostname >/etc/mesos-slave/hostname
- 創(chuàng)建work_dir
rm -rf /etc/mesos-slave/work_dir && mkdir /etc/mesos-slave/work_dir/provisioner -p
- 啟動mesos-slave
systemctl start mesos-slave
systemctl enable mesos-slave
systemctl disable mesos-master
- 實驗過程中,slave啟動失敗了昧甘,選擇用命令運行slave
mesos-slave --master=zk://1.1.1.100:2181,1.1.1.101:2181,1.1.1.102:2181/mesos --work_dir=/etc/mesos-slave/work_dir
4. 訪問Mesos
-
mesos地址:http://1.1.1.101:5050/
-
marathon地址:http://1.1.1.101:8080/
# 可利用其發(fā)布docker鏡像并可調(diào)整應(yīng)用數(shù)量
-
查看 slave
- 自此良拼,Mesos安裝成功