Apache Mesosってなに
Mesos User Group Tokyo
Mesos Meetup Tokyo #1
ハッシュタグ #MUGT
2017/05/30
Introduction
2
Shingo Kitayama
日本ヒューレット・パッカード株式会社 テクニカルアーキテクト
オープンソースソリューションの提案、コンサルティング、および構築デリバリーを担当
・元楽天 国際インフラ担当
・Ansibleの人だった気がする
Now on Sale
Agenda
3
1. Apache Mesosの概要
2. Apache Mesosのアーキテクチャ
3. Mesosphere DCOSの概要
1. Apache Mesosの概要
- What’s Apache Mesos -
4
従来のシステム管理の課題
5
Cluster A Cluster B Cluster C
仮想化環境のシステム管理では、クラスタのリソースを効率的に管理することが難しい。
• クラスタの効率的な管理?
• システムの冗長性?
• スケールアップ・スケールダウン?
Apache Mesosとは
分散システムカーネル - Distributed Systems Kernel -
Mesosは分散アプリケーションに対して、 APIを通じて効率的なリソース分離、共有を提供するプロセススケジュー
リングプラットフォームです。
Linuxカーネルのリソーススケジュールと同じ原理で設計されており、データセンタやクラウド環境全体を対象とした
リソースの管理やスケジュールを行います。
6
Executor
- Tasks -
Scheduler
- Jobs -
MesosはAPIをもっており、
フレームワークを通して制
御可能。
サーバの空きリソースや実行可能な
プログラムをMesosが管理し、どの
サーバでタスクを実行するか決める。
Apache Mesosのメリット
7
Cluster A Cluster B Cluster C
VMや物理サーバ単位でアプリを管理していては、リソースの有効活用ができなかったが、データーセンターのリソースの割合を把
握し、個別のアプリを最適配置することによって、リソースの有効活用が可能になる。
12~15%
Utilization
30~40%
Utilization
Apache Mesosの生い立ち
8
2009
A Common Substrate for
Cluster Computing
HotCloud '09 in a talk accompanying the
first paper (Nexus)
Announced Mesos
version 1
Apache Software Foundation
2010
2011
2013
Development on Aurora
began in 2010
Bill Farner, an engineer on Twitter’s research
team,
2016
Mesos: A Platform for Fine-
Grained Resource Sharing in
the Data Center
talk by Zaharia at the Usenix Symposium on
Networked Systems Design and
Implementation conference
Mesosphere Grabs $10M In Series A
Funding To Transform Server
Management
Mesosphere, a Silicon Valley startup based on the open
source Apache Mesos project, announced $10.5M in Series
A funding,
Apache Mesosの主な特徴
9
High Availability
Zookeeper を使ったフォール
トトレラントなマスター。
無停止アップグレード
Containers
DockerおよびAppCイメージ
を使用したコンテナ起動をサ
ポート。
Pluggable Isolation
CPU、メモリ、ディスク、ポート、
GPU、およびモジュールのカ
スタムリソース分離
Two Level Scheduling
スケジュールポリシーを利用し
た同じクラスタ内のクラウドネイ
ティブアプリケーションとレガ
シーアプリケーションの実行
APIs
新しい分散アプリケーション
の開発、クラスタの操作、お
よび監視のためのHTTP API
の提供。
Web UI
クラスタの状態を表示し、コン
テナのサンドボックスをナビ
ゲートするための組み込み
Web UI
Cross Platform
クラウドプロバイダーにとらわ
れず、Linux、OSX、
Windows上で動作。
Linear Scalability
10,000ノードまで容易に拡張
できることが実証されている。
http://mesos.apache.org/
Mesosの導入企業
10
普段よく利用しているモダンなサービスの多くですでに採用されている。
2. Apache Mesosのアーキテクチャ
- Architecture Overview -
11
Slave 1
Apache Mesos Overview
12
マスタはスレーブのタスク調整と管理を行う。
マスタは、スレーブがどの程度のリソースを提供できるのかを監視
し、それに応じてフレームワークに提供するリソースの数を決定す
る。
Mesos Masters
Mesos Slaves
Framework
Mesos Master Quorum
Framework A
Scheduler
Framework B
Scheduler
Leader
Standby Standby
Zoo
Keeper
Zoo
Keeper
Zoo
Keeper
…
Offer Offer
OfferOffer
Native App Native App
Framework AFramework AFramework A
Executor
Task
Slave N
Framework AFramework AFramework B
Executor
Task
スレーブは、どれだけタスクを処理できるかをマスタに報告し、マ
スタからリソースの要求を受けたときにタスクを実行する。
ユーザーが利用するインターフェイスであり、「Scheduler」と
「Executor」で構成される。
「Scheduler」は、MesosマスタへのJobの登録を担当し、オファー
を処理。
「Executor」は、タスクを実行するスレーブ上のプログラムまたはコ
マンドなど。
Mesos Masters
13
・Mesos Slavesの管理
・Mesos Frameworkの管理
・リソース割り当てと、最適配置
マスタは、リソースの共有や厳密な優先順位などのポリシーに従って、各フレームワー
クに提供すべきリソースを決定。
High Availability
マスタの高可用性は、Apache ZooKeeperを使用。
ZooKeeperはマスタのリーダーを選出し、スレーブやフレー
ムワークに対して、リーダーを通知する。
Mesosマスタが使用できない場合、既存のタスクは引き続き実行
できるが、新しいリソースを割り当てることができず、新しいタスク
を起動できない。
Slave 1
Mesos Master Quorum
Framework A
Scheduler
Framework B
Scheduler
Leader
Standby Standby
Zoo
Keeper
Zoo
Keeper
Zoo
Keeper
…
Offer Offer
OfferOffer
Native App Native App
Framework AFramework AFramework A
Executor
Task
Slave N
Framework AFramework AFramework B
Executor
Task
Leader Election
http://zookeeper.apache.org/doc/trunk/recipes.html#sc_leaderElection
Mesos Slaves
14
・リソース情報をマスタに通知
スレーブは、ローカルリソース(CPUコア、RAMなど)を管理し、これらのリソースを
Mesosマスタに登録。
・マスタからのスケジュール要求の受け入れ
・Executorの実行
Containers
cgroupやnamespaceなどのLinux固有の機能を使用して、
Executerのコンテナ化とリソース分離を提供。
Mesos ContainerizerとDocker Containerizerをサポートしていま
す。Mesos ContainerizerはネイティブのOS機能を直接使用して
コンテナ間を分離し、Docker Containerizerはコンテナ管理を
Dockerエンジンに委譲します。
Slave 1
Mesos Master Quorum
Framework A
Scheduler
Framework B
Scheduler
Leader
Standby Standby
Zoo
Keeper
Zoo
Keeper
Zoo
Keeper
…
Offer Offer
OfferOffer
Native App Native App
Framework AFramework AFramework A
Executor
Task
Slave N
Framework AFramework AFramework B
Executor
Task
Framework
15
Slave 1
Mesos Master Quorum
Framework A
Scheduler
Framework B
Scheduler
Leader
Standby Standby
Zoo
Keeper
Zoo
Keeper
Zoo
Keeper
…
Offer Offer
OfferOffer
Native App Native App
Framework AFramework AFramework A
Executor
Task
Slave N
Framework AFramework AFramework B
Executor
Task
・Schedulerは、マスタにタスクを登録。
・Executerは、スレーブ上のタスクを管理。
Batch Scheduling Data Storage
Machine Learning Big Data Processing
DevOps tooling Long Running Services
Framework
16
Slave 1
Mesos Master Quorum
Framework A
Scheduler
Framework B
Scheduler
Leader
Standby Standby
Zoo
Keeper
Zoo
Keeper
Zoo
Keeper
…
Offer Offer
OfferOffer
Native App Native App
Framework AFramework AFramework A
Executor
Task
Slave N
Framework AFramework AFramework B
Executor
Task
・Schedulerは、マスタにタスクを登録。
・Executerは、スレーブ上のタスクを管理。
Batch Scheduling Data Storage
Machine Learning Big Data Processing
DevOps tooling Long Running Services
Marathon
長期実行アプリケーションを起動するよう設計されたフレームワークの1つ
initシステムの代わり
Features
・Mesos コンテナ(cgroup)とDocker の両方に対応
・Web UI
・Task (Application) の常時稼働を保証
・サービス・ディスカバリと負荷分散
・ヘルスチェック(TCP, HTTP, Command)
Framework
17
Slave 1
Mesos Master Quorum
Framework A
Scheduler
Framework B
Scheduler
Leader
Standby Standby
Zoo
Keeper
Zoo
Keeper
Zoo
Keeper
…
Offer Offer
OfferOffer
Native App Native App
Framework AFramework AFramework A
Executor
Task
Slave N
Framework AFramework AFramework B
Executor
Task
・Schedulerは、マスタにタスクを登録。
・Executerは、スレーブ上のタスクを管理。
Batch Scheduling Data Storage
Machine Learning Big Data Processing
DevOps tooling Long Running Services
Chronos
バッチアプリケーションを起動するよう設計されたフレームワークの1つ
Airbnbによってcronの代わりに開発されたフレームワーク
Features
・分散型でフォールトトレラントなスケジューラ
・Web UI
・依存処理の実行
・Job履歴の閲覧
・ExecuterとしてDockerサポート
3. Mesosphere DCOS
- Ecosystem for Apache Mesos -
18
About Mesosphere
19
Mesosphere DCOS Architecture
20
Spark
MPI
Hadoop
Mesos SDK Marathon (init) Chronos (cron)
App
Long RunningNative Batch
ETL
Backup
Mesosphere DCOS
Services & Applications
Easily deploy and run datacenter-
wide app services such as Docker,
Cassandra, and Spark pooled on a
single platform
DC/OS Powered by Apache Mesos
Runtime, tools and best practices built-
in to simplify operations and deliver a
production self-healing infrastructure
Run Anywhere
Bare-metal, virtual, cloud or hybrid -
DC/OS runs on it all - only
requirement is a modern Linux distro;
Windows support coming soon
21
Mesosphere Enterprise DCOS
Universe
22
Summary
23
Mesosは分散アプリケーションに対して、 APIを通じて効率的なリソース
分離、共有を提供するプロセススケジューリングプラットフォームです。
使用するフレームワークによって、リソース配分の特徴が異なる。特にコ
ンテナを取り扱うときは、Marathon、Cronosがメジャーどころ。
DCOSはコンテナ環境と、既存のアプリを動作させるためのデーターセン
ターOSとしての役割りであり、エンタープライズ環境ではMesosphere
Enterprise DCOSを利用
Enjoy Mesos World
24
Thanks
Appendix
25
Slave 1
Apache Mesos Resource Offering
26
Mesos Master Quorum
Framework A
Scheduler
Framework B
Scheduler
Leader
Standby Standby
Zoo
Keeper
Zoo
Keeper
Zoo
Keeper
…
Offer Offer
OfferOffer
Native App Native App
Framework AFramework AFramework A
Executor
Task
Slave N
Framework AFramework AFramework B
Executor
Task
(1) Mesos Slave がリソース空き状況をMesos Materに伝
える。
(2) Mesos Masterはそのリソース空き状況をFramework
に対して伝える。
(3) FrameworkのSchedulerはMesos Materに対して
Mesos Slaveの上で動かすべきタスクの必要リソースを伝
える。
(4) Mesos Masterはリソースが空いているMesos Slave
に対して、Taskの実行を伝える。
27
Mesosの導入事例
https://medium.com/airbnb-engineering/data-infrastructure-at-airbnb-8adfb34f169c
28
本資料に関するお問い合わせ
Shingo.Kitayama
Mailto: shingo.kitayama@hpe.com
Mesosは、米国およびその他の国において登録されたApache Foundationの商標です。
その他、本資料で記載されているロゴ、システム名、製品名は各社及び商標権者の登録商標あるいは商標です。
本資料に関しては、お気軽にお問い合わせ下さい。
また、内容に関しては個人の意見に基づくものであり、十分考慮の上ですが、所属組織団体の公式見解とは異なる場合
がございます。 何卒、ご了承下さい。
商標

Apache Mesosってなに