【原创】大数据基础之Marathon(1)简介、安装、使用

时间:2021-01-08 23:44:02

marathon 1.6.322

【原创】大数据基础之Marathon(1)简介、安装、使用

官方: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上的容器编排平台;

【原创】大数据基础之Marathon(1)简介、安装、使用

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和认证;

【原创】大数据基础之Marathon(1)简介、安装、使用

二 安装

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

【原创】大数据基础之Marathon(1)简介、安装、使用

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/