Book Image

Learn Apache Mesos

By : Manuj Aggarwal
Book Image

Learn Apache Mesos

By: Manuj Aggarwal

Overview of this book

Apache Mesos is an open source cluster manager that provides efficient resource isolation and sharing across distributed applications or frameworks. This book will help you build a strong foundation of Mesos' capabilities along with practical examples to support the concepts explained throughout the book. Learn Apache Mesos dives straight into how Mesos works. You will be introduced to the distributed system and its challenges and then learn how you can use Mesos and its framework to solve data problems. You will also gain a full understanding of Mesos' internal mechanisms and get equipped to use Mesos and develop applications. Furthermore, this book lets you explore all the steps required to create highly available clusters and build your own Mesos frameworks. You will also cover application deployment and monitoring. By the end of this book, you will have learned how to use Mesos to make full use of machines and how to simplify data center maintenance.
Table of Contents (10 chapters)

Introduction to Apache Mesos

Imagine an e-commerce application server where, if you are selling a product, lots of users access your website. This creates a huge amount of data and requires more CPU memory and disk space. Day-by-day users increase, so the demand for resources increases. To cater to these needs, you use data centers and the cloud to provide these additional resources. Apache Mesos helps to manage and share these resources in an efficient manner, and also helps us with scalable deployments by forming a cluster.

A Mesos cluster is made up of four major components:

  • ZooKeeper
  • Mesos masters
  • Mesos slaves
  • Frameworks

Architecture of Mesos

Mesos has an architecture with the combination of master and slave daemons and frameworks. Here are a few definitions of components used in our architecture:

  • Master daemon: Mesos master runs on a master node and organizes the slave daemons, so we will have three master nodes where we will install Mesos master, and it will manage the Mesos slave server, which runs on the other three servers.
  • Slave daemon: Mesos slave runs on slave nodes and runs tasks that belong to the framework, so we will be having a Marathon framework, which will register with the Mesos master and will schedule the Docker containers, and those Docker containers will run on Mesos slave servers.
  • Framework: The framework, which can also be called the Mesos application, consists of a scheduler, which registers with the master to achieve resource offers, and one or more executors, which pushes the tasks on slaves. An example of a Mesos framework is Marathon. The Marathon framework can be used in the scheduling of tasks. So, the Marathon framework gets registered with the Mesos master and it receives the resource offers. This framework also deploys the application on the Mesos cluster, which gets launched on slaves.

Following are other important components of the Mesos architecture:

  • Offer: The master gets offers from the slave nodes and the master provides offers to the registered frameworks. So, all the resources are on slave node, such as CPU memory and disk, and then the Mesos master provides offers to the registered framework, which is Marathon.
  • Task: A unit of work that is scheduled by a framework, Marathon, and tasks are like Docker. If we run any image of Docker, those Docker images will run on a slave node. Tasks can be anything, from a bash command, or script, or running a Docker container.
  • Apache ZooKeeper: It's a software that is used to coordinate the master nodes. It elects the master leader, and if out of three nodes any node is down, it again elects the leader from the remaining two nodes. A minimum of three nodes is required to form a cluster.