Book Image

Mastering Mesos

By : Dipa Dubhashi, Akhil Das
Book Image

Mastering Mesos

By: Dipa Dubhashi, Akhil Das

Overview of this book

Apache Mesos is open source cluster management software that provides efficient resource isolations and resource sharing distributed applications or frameworks. This book will take you on a journey to enhance your knowledge from amateur to master level, showing you how to improve the efficiency, management, and development of Mesos clusters. The architecture is quite complex and this book will explore the difficulties and complexities of working with Mesos. We begin by introducing Mesos, explaining its architecture and functionality. Next, we provide a comprehensive overview of Mesos features and advanced topics such as high availability, fault tolerance, scaling, and efficiency. Furthermore, you will learn to set up multi-node Mesos clusters on private and public clouds. We will also introduce several Mesos-based scheduling and management frameworks or applications to enable the easy deployment, discovery, load balancing, and failure handling of long-running services. Next, you will find out how a Mesos cluster can be easily set up and monitored using the standard deployment and configuration management tools. This advanced guide will show you how to deploy important big data processing frameworks such as Hadoop, Spark, and Storm on Mesos and big data storage frameworks such as Cassandra, Elasticsearch, and Kafka.
Table of Contents (16 chapters)
Mastering Mesos
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface
Index

Preface

Apache Mesos abstracts CPU, memory, storage, and other compute resources away from machines (physical or virtual), enabling fault-tolerant and elastic distributed systems to easily be built and run effectively. It improves resource utilization, simplifies system administration, and supports a wide variety of distributed applications that can be effortlessly deployed leveraging its pluggable architecture.

This book will provide a detailed step-by-step guide to deploying a Mesos cluster using all the standard DevOps tools to port Mesos frameworks effectively and in general demystify the concept of Mesos.

The book will first establish the raison d'être of Mesos and explain its architecture in an effective manner. From there, the book will walk the reader through the complex world of Mesos, moving progressively from simple single machine setups to highly complex multi-node cluster setups with new concepts logically introduced along the way. At the end of the journey, the reader will be armed with all the resources that he/she requires to effectively manage the complexities of today's modern datacenter requirements.

What this book covers

Chapter 1, Introducing Mesos, introduces Mesos, dives deep into its architecture, and introduces some important topics, such as frameworks, resource allocation, and resource isolation. It also discusses the two-level scheduling approach that Mesos employs, provides a detailed overview of its API, and provides a few examples of how Mesos is used in production.

Chapter 2, Mesos Internals, provides a comprehensive overview of Mesos' features and walks the reader through several important topics regarding high availability, fault tolerance, scaling, and efficiency, such as resource allocation, resource reservation, and recovery, among others.

Chapter 3, Getting Started with Mesos, covers how to manually set up and run a Mesos cluster on the public cloud (AWS, GCE, and Azure) as well as on a private datacentre (on premise). It also discuss the various debugging methods and explores how to troubleshoot the Mesos setup in detail.

Chapter 4, Service Scheduling and Management Frameworks, introduces several Mesos-based scheduling and management frameworks or applications that are required for the easy deployment, discovery, load balancing, and failure handling of long-running services.

Chapter 5, Mesos Cluster Deployment, explains how a Mesos cluster can be easily set up and monitored using the standard deployment and configuration management tools used by system administrators and DevOps engineers. It also discusses some of the common problems faced while deploying a Mesos cluster along with their corresponding resolutions.

Chapter 6, Mesos Frameworks, walks the reader through the concept and features of Mesos frameworks in detail. It also provides a detailed overview of the Mesos API, including the new HTTP Scheduler API, and provides a recipe to build custom frameworks on Mesos.

Chapter 7, Mesos Containerizers, introduces the concepts of containers and talks a bit about Docker, probably the most popular container technology available today. It also provides a detailed overview of the different "containerizer" options in Mesos, besides introducing some other topics such as networking for Mesos-managed containers and the fetcher cache. Finally, an example of deploying containerized apps in Mesos is provided for better understanding.

Chapter 8, Mesos Big Data Frameworks, acts as a guide to deploying important big data processing frameworks such as Hadoop, Spark, Storm, and Samza on top of Mesos.

Chapter 9, Mesos Big Data Frameworks 2, guides the reader through deploying important big data storage frameworks such as Cassandra, the Elasticsearch-Logstash-Kibana (ELK) stack, and Kafka on top of Mesos.

What you need for this book

To get the most of this book, you need to have basic understanding of Mesos and cluster management along with familiarity with Linux. You will also need to have access to cloud services such as AWS, GCE, and Azure, preferably running with 15 GB RAM and four cores on the Ubuntu or CentOS operating system.

Who this book is for

The book aims to serve DevOps engineers and system administrators who are familiar with the basics of managing a Linux system and its tools

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "For the sake of simplicity, we will simply run the sleep command."

A block of code is set as follows:

{
  "args": [
    "--zk=zk://Zookeeper.service.consul:2181/Mesos"
  ],  
  "container": {
    "type": "DOCKER",
    "Docker": {
      "network": "BRIDGE",
      "image": "{{ Mesos_consul_image }}:{{ Mesos_consul_image_tag }}"
    }   
  },  
  "id": "Mesos-consul",
  "instances": 1,
  "cpus": 0.1,
  "mem": 256
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

    # Tasks for Master, Slave, and ZooKeeper nodes

- name: Install mesos package
  apt: pkg={{item}} state=present update_cache=yes
  with_items:
    - mesos={{ mesos_pkg_version }}
  sudo: yes

Any command-line input or output is written as follows:

# Update the packages.
$ sudo apt-get update
# Install the latest OpenJDK.
$ sudo apt-get install -y openjdk-7-jdk
# Install autotools (Only necessary if building from git repository).
$ sudo apt-get install -y autoconf libtool
# Install other Mesos dependencies.
$ sudo apt-get -y install build-essential python-dev python-boto libcurl4-nss-dev libsasl2-dev maven libapr1-dev libsvn-dev

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Now press the ADD button to add a specific port."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

You can download the code files by following these steps:

  1. Log in or register to our website using your e-mail address and password.

  2. Hover the mouse pointer on the SUPPORT tab at the top.

  3. Click on Code Downloads & Errata.

  4. Enter the name of the book in the Search box.

  5. Select the book for which you're looking to download the code files.

  6. Choose from the drop-down menu where you purchased this book from.

  7. Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows

  • Zipeg / iZip / UnRarX for Mac

  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github. com/PacktPublishing/Mastering-Mesos. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.