標籤:mesos zookeeper marathon 叢集 docker
參考文章:
http://www.xuliangwei.com/xubusi/422.html
https://open.mesosphere.com/getting-started/install/#master-setup
https://www.digitalocean.com/community/tutorials/how-to-configure-a-production-ready-mesosphere-cluster-on-ubuntu-14-04
安裝環境:
3台server
192.168.100.10 mesos-master Mesos-master slave、Zookeeper、Marathon、(marathon-lb)
192.168.100.20 mesos-node1 Mesos-master slave、Zookeeper、Marathon
192.168.100.30 mesos-node2 Mesos-master slave、Zookeeper、Marathon
hosts:
192.168.100.10 mesos-master
192.168.100.20 mesos-node1
192.168.100.30 mesos-node2
1、yum安裝軟體包
在3台服務上分別操作:
rpm -Uvh http://repos.mesosphere.io/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm
yum -y install mesos marathon
yum -y install mesosphere-zookeeper
2、添加myid檔案
分別在3台機器上操作
vim /var/lib/zookeeper/myid
分別編輯內容,分別添加上 1 ,2,3進去
[[email protected] ~]# cat /var/lib/zookeeper/myid
1
[[email protected] ~]# cat /var/lib/zookeeper/myid
2
[[email protected] ~]# cat /var/lib/zookeeper/myid
3
3、分別編輯3台伺服器的 /etc/zookeeper/conf/zoo.cfg檔案
添加:
server.1=192.168.100.10:2888:3888
server.2=192.168.100.20:2888:3888
server.3=192.168.100.30:2888:3888
4、分別在3台機器上重啟 zookeeper服務
systemctl restart zookeeper
5、檢測zookeeper啟動狀態
ps -ef|grep zookeeper
[[email protected] ~]# ps -ef|grep zookeeper
root 2674 1 7 18:39 ? 00:00:00 java -Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO,CONSOLE -cp /opt/mesosphere/zookeeper/bin/../build/classes:/opt/mesosphere/zookeeper/bin/../build/lib/*.jar:/opt/mesosphere/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/opt/mesosphere/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/opt/mesosphere/zookeeper/bin/../lib/netty-3.7.0.Final.jar:/opt/mesosphere/zookeeper/bin/../lib/log4j-1.2.16.jar:/opt/mesosphere/zookeeper/bin/../lib/jline-0.9.94.jar:/opt/mesosphere/zookeeper/bin/../zookeeper-3.4.6.jar:/opt/mesosphere/zookeeper/bin/../src/java/lib/*.jar:/etc/zookeeper/conf: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain /etc/zookeeper/conf/zoo.cfg
root 2721 2255 0 18:39 pts/0 00:00:00 grep --color=auto zookeeper
6、分別編輯3台伺服器的/etc/mesos/zk設定檔,添加
zk://192.168.100.10:2181,192.168.100.20:2181,192.168.100.30:2181/mesos
7、 分別編輯3台伺服器,修改判斷值 /etc/mesos-master/quorum
新增內容為: 2
說明:
如果3台主mesos,這裡的值就是取節點的數量除以2再加1,取整數部分。如果是3台節點,這裡的值就是2;如果是4台主mesos,這裡的值就是3.
編輯mesos-master:
[[email protected] mesos-master]# pwd
/etc/mesos-master
[[email protected] mesos-master]# cat hostname
192.168.100.10 (其他2台為20,30)
[[email protected] mesos-master]# cat ip
192.168.100.10 (其他2台為20,30)
[[email protected] mesos-master]# cat quorum
2
編輯 mesos-slave:
[[email protected] mesos-slave]# pwd
/etc/mesos-slave
[[email protected] mesos-slave]# cat hostname
192.168.100.30
[[email protected] mesos-slave]# cat ip
192.168.100.30
8、分別編輯3台伺服器的marathon,修改配置如下:
mkdir -p /etc/marathon/conf
cd /etc/marathon/conf
vim hostname
添加:
192.168.100.10 (其他2台為20,30)
最後重啟各個服務:
systemctl restart mesos-master
systemctl restart zookeeper
systemctl restart marathon.service
systemctl restart mesos-slave
設定開機自啟動:
systemctl enable mesos-master
systemctl enable zookeeper
systemctl enable marathon.service
systemctl enable mesos-slave
訪問看效果:
650) this.width=650;" src="http://s1.51cto.com/wyfs02/M01/8C/F7/wKiom1iAC9nxDOKbAAPqGQunH7U316.png-wh_500x0-wm_3-wmp_4-s_289605052.png" title="11.png" alt="wKiom1iAC9nxDOKbAAPqGQunH7U316.png-wh_50" />
650) this.width=650;" src="http://s5.51cto.com/wyfs02/M02/8C/F4/wKioL1iADAHgF2arAAS8SGC4wX4663.png-wh_500x0-wm_3-wmp_4-s_1447006714.png" style="float:none;" title="22.png" alt="wKioL1iADAHgF2arAAS8SGC4wX4663.png-wh_50" />
650) this.width=650;" src="http://s4.51cto.com/wyfs02/M01/8C/F4/wKioL1iADALieppoAAPXmePwB18600.png-wh_500x0-wm_3-wmp_4-s_2250751607.png" style="float:none;" title="33.png" alt="wKioL1iADALieppoAAPXmePwB18600.png-wh_50" />
這裡如果用戶端顯示不了的話,可以嘗試清理mesos日誌:
清理mesos:rm -rf /var/lib/mesos/*
650) this.width=650;" src="http://s2.51cto.com/wyfs02/M00/8C/F4/wKioL1iADDGS2kU9AANqATLTyNs858.png-wh_500x0-wm_3-wmp_4-s_3538514005.png" title="44.png" alt="wKioL1iADDGS2kU9AANqATLTyNs858.png-wh_50" />
9、配置marathon,使其可以建立docker容器:
在這3台服務上安裝docker服務
yum install -y docker
systemctl start docker
systemctl enable docker
安裝鏡像: 例如nginx
在所有mesos-slave上增加配置參數,並重啟
# echo ‘docker,mesos‘ | tee /etc/mesos-slave/containerizers
# systemctl restart mesos-slave #重啟Mesos-slave
之後可以在marathon的頁面進行建立docker容器:
650) this.width=650;" src="http://s4.51cto.com/wyfs02/M01/8C/F7/wKiom1iADEPhxXAjAANki_v0RyM199.png-wh_500x0-wm_3-wmp_4-s_1878913771.png" title="55.png" alt="wKiom1iADEPhxXAjAANki_v0RyM199.png-wh_50" />
本文出自 “苦咖啡's營運之路” 部落格,請務必保留此出處http://alsww.blog.51cto.com/2001924/1893070
CentOS 7 安裝Mesos+Marathon+Zookeeper叢集