marathon 1.6.322
官方:https://mesosphere.github.io/marathon/
一 簡介
Marathon is a production-grade container orchestration platform for Mesosphere’s Datacenter Operating System (DC/OS) and Apache Mesos.\
marathon是一個DC/OS和mesos上的容器編排平台;
Features
- High Availability. Marathon runs as an active/passive cluster with leader election for 100% uptime.
- Multiple container runtimes. Marathon has first-class support for both Mesos containers (using cgroups) and Docker.
- Stateful apps. Marathon can bind persistent storage volumes to your application. You can run databases like MySQL and Postgres, and have storage accounted for by Mesos.
- Beautiful and powerful UI.
- Constraints. These allow to e.g. place only one instance of an application per rack, node, etc.
- Service Discovery & Load Balancing. Several methods available.
- Health Checks. Evaluate your application’s health using HTTP or TCP checks.
- Event Subscription. Supply an HTTP endpoint to receive notifications - for example to integrate with an external load balancer.
- Metrics. Query them at /metrics in JSON format or push them to systems like graphite, statsd and Datadog.
- Complete REST API for easy integration and scriptability.
特點:高可用、支持多種容器運行時環境、支持狀態應用、UI、支持部署限制、服務發現&負載均衡、健康檢查、事件訂閱、日志收集、REST API;
DC/OS features
Running on DC/OS, Marathon gains the following additional features:
- Virtual IP routing. Allocate a dedicated, virtual address to your app. Your app is now reachable anywhere in the cluster, wherever it might be scheduled. Load balancing and rerouting around failures are done automatically.
- Authorization (DC/OS Enterprise Edition only). True multitenancy with each user or group having access to their own applications and groups.
在DC/OS上還提供虛ip和認證;
二 安裝
1 官方tar包安裝
$ curl -O https://downloads.mesosphere.com/marathon/releases/1.6.322/marathon-1.6.322-2bf46b341.tgz
$ tar xzf marathon-1.6.322-2bf46b341.tgz
$ cd marathon-1.6.322-2bf46b341
$ ls bin
backup backup.bat marathon marathon.bat restore restore.bat
啟動
$ ./bin/mathon --master zk://$zk1:2181,$zk2:2181/mesos --zk zk://$zk1:2181,$zk2:2181/marathon --http_port 8090
默認的8080很容易沖突
2 官方yum安裝
# rpm -ivh http://repos.mesosphere.com/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm
# yum install marathon
3 離線安裝
# rpm -ivh http://repos.mesosphere.com/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm
# yum install --downloadonly --downloaddir=/path/to/rpm/marathon marathon
# ls -l /path/to/rpm/marathon
total 75276
-rw-r--r-- 1 root root 77071702 Jan 29 07:41 marathon-1.7.189-0.1.20190125223314.el7.noarch.rpm# rpm -ivh marathon-1.7.189-0.1.20190125223314.el7.noarch.rpm
安裝目錄
# ls /usr/share/marathon/bin
backup backup.bat marathon marathon.bat restore restore.bat
修改配置
# vi /etc/default/marathon
MARATHON_MASTER=zk://$zk1:2181,$zk2:2181/mesos
MARATHON_ZK=zk://$zk1:2181,$zk2:2181/marathon
MARATHON_HTTP_PORT=8090
啟動
# service marathon start
or
# systemctl start marathon
開機啟動
# systemctl enable marathon
查看狀態
# service marathon status
or
# systemctl status marathon
如果有報錯查看日志
# journalctl -u marathon -r
三 使用
http接口
訪問 http://$marathon_server:8090
api接口
$ curl http://$marathon_server:8090/v2/apps
添加app
# curl -X POST http://$marathon_ip:8080/v2/apps -d@/path/to/app.json -H 'Content-type:application/json'
查看app
# curl http://$marathon_ip:8080/v2/apps/$app_id
刪除app
# curl -X DELETE http://$marathon_ip:8080/v2/apps/$app_id
重啟app
# curl -XPOST http://$marathon_ip:8080/v2/apps/$app_id/restart
具體參考:http://mesosphere.github.io/marathon/api-console/index.html
參考:https://mesosphere.github.io/marathon/docs/