You are previewing Mastering Mesos.
O'Reilly logo
Mastering Mesos

Book Description

The ultimate guide to managing, building, and deploying large-scale clusters with Apache Mesos

About This Book

  • Master the architecture of Mesos and intelligently distribute your task across clusters of machines

  • Explore a wide range of tools and platforms that Mesos works with

  • This real-world comprehensive and robust tutorial will help you become an expert

  • 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

    What You Will Learn

  • Understand the Mesos architecture

  • Manually spin up a Mesos cluster on a distributed infrastructure

  • Deploy a multi-node Mesos cluster using your favorite DevOps

  • See the nuts and bolts of scheduling, service discovery, failure handling, security, monitoring, and debugging in an enterprise-grade, production cluster deployment

  • Use Mesos to deploy big data frameworks, containerized applications, or even custom build your own applications effortlessly

  • In Detail

    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.

    Style and approach

    This advanced guide provides a detailed step-by-step account of deploying a Mesos cluster. It will demystify the concepts behind Mesos.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased 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 code file.

    Table of Contents

    1. Mastering Mesos
      1. Table of Contents
      2. Mastering Mesos
      3. Credits
      4. About the Authors
      5. About the Reviewer
      6. www.PacktPub.com
        1. eBooks, discount offers, and more
          1. Why subscribe?
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. Introducing Mesos
        1. Introduction to the datacenter OS and architecture of Mesos
        2. The architecture of Mesos
        3. Introduction to frameworks
          1. Frameworks built on Mesos
            1. Long-running services
            2. Big data processing
            3. Batch scheduling
            4. Data storage
        4. The attributes and resources of Mesos
          1. Attributes
          2. Resources
            1. Examples
        5. Two-level scheduling
        6. Resource allocation
          1. Max-min fair share algorithm
        7. Resource isolation
        8. Monitoring in Mesos
          1. Monitoring provided by Mesos
            1. Types of metrics
        9. The Mesos API
          1. Messages
          2. API details
            1. Executor API
            2. The Executor Driver API
            3. The Scheduler API
            4. The Scheduler Driver API
        10. Mesos in production
          1. Case study on HubSpot
            1. The cluster environment
            2. Benefits
            3. Challenges
            4. Looking ahead
        11. Summary
      9. 2. Mesos Internals
        1. Scaling and efficiency
          1. Resource allocation
          2. The Dominant Resource Fairness algorithm (DRF)
          3. Weighted DRF
          4. Configuring resource offers on Mesos
        2. Reservation
          1. Static reservation
            1. Role definition
            2. Framework assignment
          2. Role resource policy setting
          3. Dynamic reservation
            1. Offer::Operation::Reserve
            2. Offer::Operation::Unreserve
              1. /reserve
              2. /unreserve
          4. Oversubscription
            1. Revocable resource offers
              1. Registering with the revocable resources capability
              2. An example offer with a mix of revocable and standard resources
            2. Resource estimator
            3. The QoS controller
            4. Configuring oversubscription
          5. Extendibility
        3. Mesos modules
          1. Module invocation
            1. Building a module
          2. Hooks
          3. The currently supported modules
            1. The allocator module
              1. Implementing a custom allocator module
        4. High availability and fault tolerance
          1. Mastering high availability
          2. Framework scheduler fault tolerance
          3. Slave fault tolerance
          4. Executor/task
          5. Slave recovery
            1. Enabling slave checkpointing
            2. Enabling framework checkpointing
        5. Reconciliation
          1. Task reconciliation
          2. Offer reconciliation
        6. Persistent Volumes
          1. Offer::Operation::Create
          2. Offer::Operation::Destroy
        7. Summary
      10. 3. Getting Started with Mesos
        1. Virtual Machine (VM) instances
        2. Setting up a multi-node Mesos cluster on Amazon Web Services (AWS)
          1. Instance types
            1. Launching instances
          2. Installing Mesos
          3. Downloading Mesos
          4. Building Mesos
          5. Using mesos-ec2 script to launch many machines at once
        3. Setting up a multi-node Mesos cluster on Google Compute Engine (GCE)
          1. Introduction to instance types
          2. Launching machines
            1. Set up a Google Cloud Platform project
          3. Create the network and firewall rules
          4. Create the instances
          5. Installing Mesos
          6. Downloading Mesos
          7. Building Mesos
        4. Setting up a multi-node Mesos cluster on Microsoft Azure
          1. Introduction to instance types
          2. Launching machines
            1. Create a cloud service
            2. Create the instances
          3. Configuring the network
          4. Installing Mesos
          5. Downloading Mesos
          6. Building Mesos
          7. Starting mesos-master
          8. Start mesos-slaves
          9. Mesos commands
          10. Testing the installation
        5. Setting up a multi-node Mesos cluster on your private datacenter
          1. Installing Mesos
            1. Preparing the environment
          2. Downloading Mesos
          3. Building Mesos
          4. Starting mesos-master
          5. Starting mesos-slaves
          6. Automating the process when you have many machines
        6. Debugging and troubleshooting
          1. Handling missing library dependencies
          2. Issues with directory permissions
          3. Missing Mesos library (libmesos*.so not found)
          4. Debugging a failed framework
            1. Understanding the Mesos directory structure
          5. Mesos slaves are not connecting with Mesos masters
          6. Launching multiple slave instances on the same machine
        7. Summary
      11. 4. Service Scheduling and Management Frameworks
        1. Using Marathon to launch and manage long-running applications on Mesos
          1. Installing Marathon
          2. Installing ZooKeeper to store the state
          3. Launching Marathon in local mode
        2. Multi-node Marathon cluster setup
          1. Launching a test application from the UI
          2. Scaling the application
          3. Terminating the application
        3. Chronos as a cluster scheduler
          1. Installing Chronos
          2. Scheduling a new job
        4. Chronos plus Marathon
          1. The Chronos REST API endpoint
            1. Listing the running jobs
            2. Manually starting a job
            3. Adding a scheduled job
            4. Deleting a job
            5. Deleting all the tasks of a job
          2. The Marathon REST API endpoint
            1. Listing the running applications
            2. Adding an application
            3. Changing the configuration of an application
            4. Deleting the application
        5. Introduction to Apache Aurora
          1. Installing Aurora
        6. Introduction to Singularity
          1. Installing Singularity
          2. Creating a Singularity configuration file
        7. Service discovery using Marathoner
        8. Service discovery using Consul
          1. Running Consul
        9. Load balancing with HAProxy
          1. Creating the bridge between HAProxy and Marathon
        10. Bamboo - Automatically configuring HAProxy for Mesos plus Marathon
        11. Introduction to Netflix Fenzo
        12. Introduction to PaaSTA
        13. A comparative analysis of different Scheduling/Management frameworks
        14. Summary
      12. 5. Mesos Cluster Deployment
        1. Deploying and configuring a Mesos cluster using Ansible
          1. Installing Ansible
          2. Installing the control machine
          3. Creating an ansible-mesos setup
        2. Deploying and configuring Mesos cluster using Puppet
        3. Deploying and configuring a Mesos cluster using SaltStack
          1. SaltStack installation
        4. Deploying and configuring a Mesos cluster using Chef
          1. Recipes
          2. Configuring mesos-master
          3. Configuring mesos-slave
        5. Deploying and configuring a Mesos cluster using Terraform
          1. Installing Terraform
          2. Spinning up a Mesos cluster using Terraform on Google Cloud
          3. Destroying the cluster
        6. Deploying and configuring a Mesos cluster using Cloudformation
          1. Setting up cloudformation-zookeeper
          2. Using cloudformation-mesos
        7. Creating test environments using Playa Mesos
          1. Installations
        8. Monitoring the Mesos cluster using Nagios
          1. Installing Nagios 4
        9. Monitoring the Mesos cluster using Satellite
          1. Satellite installation
        10. Common deployment issues and solutions
        11. Summary
      13. 6. Mesos Frameworks
        1. Introduction to Mesos frameworks
        2. Frameworks – Authentication, authorization, and access control
          1. Framework authentication
            1. Configuration options
          2. Framework authorization
          3. Access Control Lists (ACLs)
            1. Examples
        3. The Mesos API
          1. The scheduler HTTP API
          2. Request Calls
            1. Subscribe
            2. TEARDOWN
            3. ACCEPT
            4. DECLINE
            5. REVIVE
            6. KILL
            7. SHUTDOWN
            8. ACKNOWLEDGE
            9. RECONCILE
            10. MESSAGE
            11. REQUEST
          3. Response events
            1. SUBSCRIBED
            2. OFFERS
            3. RESCIND
            4. UPDATE
            5. MESSAGE
            6. FAILURE
            7. ERROR
            8. HEARTBEAT
        4. Building a custom framework on Mesos
          1. Driver implementation
          2. Executor implementation
          3. Scheduler implementation
          4. Running the framework
        5. Summary
      14. 7. Mesos Containerizers
        1. Containers
          1. Why containers?
        2. Docker
          1. Containerizer
            1. Motivation
            2. Containerizer types
            3. Containerizer creation
        3. Mesos containerizer
          1. The launching process
          2. Mesos containerizer states
          3. Internals
            1. Shared Filesystem
            2. Pid namespace
            3. Posix Disk isolator
          4. Docker containerizer
            1. Setup
            2. Launching process
            3. Docker containerizer states
            4. Composing containerizer
        4. Networking for Mesos-managed containers
          1. Architecture
          2. Key terms
          3. The process
          4. IP-per-container capability in frameworks
            1. NetworkInfo message
            2. Examples for specifying network requirements
          5. Address discovery
          6. Implementing a Custom Network Isolator Module
          7. Monitoring container network statistics
            1. Example statistics
        5. Mesos Image Provisioner
          1. Setup and configuration options
        6. Mesos fetcher
          1. Mechanism
          2. Cache entry
          3. URI flow diagram
          4. Cache eviction
        7. Deploying containerized apps using Docker and Mesos
        8. Summary
      15. 8. Mesos Big Data Frameworks
        1. Hadoop on Mesos
          1. Introduction to Hadoop
            1. MapReduce
            2. Hadoop Distributed File System
          2. Setting up Hadoop on Mesos
          3. An advanced configuration guide
          4. Common problems and solutions
        2. Spark on Mesos
          1. Why Spark
            1. Logistic regression in Hadoop and Spark
          2. The Spark ecosystem
            1. Spark Core
            2. Spark SQL
            3. Spark Streaming
            4. MLlib
            5. GraphX
          3. Setting up Spark on Mesos
            1. Submitting jobs in client mode
            2. Submitting jobs in cluster mode
            3. An advanced configuration guide
              1. Spark configuration properties
        3. Storm on Mesos
          1. The Storm architecture
          2. Setting up Storm on Mesos
            1. Running a sample topology
            2. An advanced configuration guide
          3. Deploying Storm through Marathon
        4. Samza on Mesos
          1. Important concepts of Samza
            1. Streams
            2. Jobs
            3. Partitions
            4. Tasks
            5. Dataflow graphs
          2. Setting up Samza on Mesos
            1. The deployment of Samza through Marathon
            2. An advanced configuration guide
        5. Summary
      16. 9. Mesos Big Data Frameworks 2
        1. Cassandra on Mesos
          1. Introduction to Cassandra
          2. Setting up Cassandra on Mesos
          3. An advanced configuration guide
        2. The Elasticsearch-Logstash-Kibana (ELK) stack on Mesos
          1. Introduction to Elasticsearch, Logstash, and Kibana
            1. Elasticsearch
            2. Logstash
            3. Kibana
            4. The ELK stack data pipeline
          2. Setting up Elasticsearch-Logstash-Kibana on Mesos
            1. Elasticsearch on Mesos
            2. Logstash on Mesos
              1. Logstash on Mesos configurations
            3. Kibana on Mesos
        3. Kafka on Mesos
          1. Introduction to Kafka
          2. Use cases of Kafka
          3. Setting up Kafka
            1. Kafka logs management
          4. An advanced configuration guide
        4. Summary
      17. Index