iT邦幫忙

2017 iT 邦幫忙鐵人賽
DAY 6
0
Cloud

用30天來建構和操作Apache Mesos系列 第 6

Day6:介紹Marathon Framework

前面幾天我們已經安裝好了Mesos的環境,今天可以開始介紹Marathon Framework,它的功能其實就跟它的名字一樣像是跑馬拉松一樣long time service,它是確保每台的service都能夠長時間的在執行,如果有一台的service當掉或是被kill掉它會在其它的機器上被啟動起來,然後它可以執行linux的shell script或是docker上,下圖是Mesos和Marathon的系統架構:

http://ithelp.ithome.com.tw/upload/images/20161206/20103456Q9OTIHZdeA.png

上圖就是Mesos、Marathon、Zookeeper結合在一起的架構,以下就分為如何啟動Marathon和Client如何的使用Marathon這二部份去講解,明天會介紹Marathon Framework如何安裝:

1、在安裝Marathon之前要先確認JDK是否有安裝,另外也要安裝zookeeper這樣才有辦法啟動Marathon

啟動指令如下:

$ ./bin/start --master zk://host1:2181,host2:2181/mesos --zk  zk://host1:2181,host2:2181,host3:2181/marathon

2、client端要使用Marathon除了可以透過它提供webui,也可以透過curl或是postman的方式連線到Marathon提供的Restful介面,這在之後也會實際的操作

下圖提供一個比上圖更加簡單的架構,但這個做法只適合在開發環境上測試使用不適合在production環境上使用。

http://ithelp.ithome.com.tw/upload/images/20161206/201034561pUe6X4ecP.png

上圖主要是mesos master沒有使用zookeeper的做法,但是marathon一定要使用zookeeper,您也可以只使用一台的zookeeper,這種架構下啟動marathon指令如下:

$ ./bin/start –master mesos-master:5050 --zk zk://host1:2181,host2:2181,host3:2181/marathon

在這幾天將介紹Marathon Framework,主要的內容如下:

1、把Marathon安裝起來並顯示它的web ui畫面

2、使用curl 的方式連線到marathon的restful上,呼叫它把tomcat service啟動起來

3、因為tomcat service可能會在mesos slave上啟動多台因此使用者可能不知道要連到哪台去,這時侯可以使用Mesos DNS解決這個問題

4、測試啟動2 台的tomcat service,並且用手動的方式kill 掉 service看會不會在其它的mesos slave上動新部署tomcat service

參考資料:

Marathon官網:https://mesosphere.github.io/marathon/


上一篇
Day5:安裝和啟動Apache Mesos(三)
下一篇
Day7:Mesos Framework Marathon安裝
系列文
用30天來建構和操作Apache Mesos30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言