Learn Apache Mesos - Manuj Aggarwal - E-Book

Learn Apache Mesos E-Book

Manuj Aggarwal

0,0
27,59 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

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.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 188

Veröffentlichungsjahr: 2018

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Learn Apache Mesos
A beginner's guide to scalable cluster management and deployment
Manuj Aggarwal
BIRMINGHAM - MUMBAI

Learn Apache Mesos

Copyright © 2018 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

Commissioning Editor: Pravin DhandreAcquisition Editor: Divya PoojariContent Development Editor: Karan ThakkarTechnical Editor: Dinesh PawarCopy Editor: Safis EditingProject Coordinator: Nidhi JoshiProofreader: Safis EditingIndexer: Pratik ShirodkarGraphics: Jisha ChirayilProduction Coordinator: Nilesh Mohite

First published: October 2018

Production reference: 1311018

Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.

ISBN 978-1-78913-738-5

www.packtpub.com

mapt.io

Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.

Why subscribe?

Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals

Improve your learning with Skill Plans built especially for you

Get a free eBook or video every month

Mapt is fully searchable

Copy and paste, print, and bookmark content

Packt.com

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.

At www.packt.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.

Contributors

About the author

Manuj Aggarwal is an entrepreneur, investor, and technology enthusiast. Over the last few years, he has been a business owner, technical architect, CTO, coder, start up consultant, and more.

Currently, he is the principal consultant, architect, and CTO of a software consulting company, TetraNoodle Technologies, based in Vancouver, Canada. He works with various start-ups on a number of cutting edge and interesting problems. Whether it is ideation and the refining of your start up idea, or building a dream team to execute the idea, he provides a diverse set of solutions that help these start-ups to succeed in their plans.He has been active in the software industry since 1997, and has worked with early-stage businesses through to Fortune 100 mega-corporations. He is passionate about sharing all the knowledge that he has acquired over the years. He is particularly interested in helping technical and non-technical entrepreneurs, founders, and co-founders of tech start-ups.

Packt is searching for authors like you

If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insights with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.

Table of Contents

Title Page

Copyright and Credits

Learn Apache Mesos

Packt Upsell

Why subscribe?

Packt.com

Contributors

About the author

Packt is searching for authors like you

Preface

Who this book is for

What this book covers

To get the most out of this book

Download the example code files

Download the color images

Conventions used

Get in touch

Reviews

Deploying Apache Mesos on AWS

Introduction to Apache Mesos

Architecture of Mesos

Introduction to Amazon Web Service (AWS)

AWS environment

Summary

Setting up Mesos Single-Cluster Nodes

Setup of servers on AWS

Creating a VPC on AWS

Creating subnets

Creating a route table

Creating EC2 instances

Creating backup

Adding a Mesosphere repository in CentOS

Installing Docker Community Edition

Configuring ZooKeeper

ZooKeeper

Installation of the Marathon framework

Configuration of Marathon

Mesos services

Deploying the Marathon application

Summary

Installation of Mesosphere

Outlining goals

Setting up the framework

Configuring the mesos-master servers

Configuring Marathon

High availability and resilience

Adding slaves

Mesos administration

Getting started

Changing hostnames on CentOS

Establishing communication

Installing Mesos

Installing ZooKeeper

Installing Marathon

Validating services

Installing Docker

Summary

Apache Mesos Administration

Scheduling and allocating resources

Understanding resource scheduling

Understanding resource allocation

Modifying Mesos slave resources and attributes

How to do it...

How it works...

How to do it...

High availability

Fault tolerance

Configuration setup of Mesosphere

Configuring ZooKeeper connection information for Mesos

Configuring Mesos on the master server

Configuring the hostname and IP address

Configuring Marathon services

Allowing inbound access to Mesos and Marathon console in AWS

Summary

Deploying Services on Mesos Cluster

Deploying applications to clusters

Setting up the Marathon

MySQL database on AWS

Setting up Marathon-lb

Summary

Persistent Volumes

Introduction to persistent volumes

Need for persistent volumes

Volume persistent using Docker

Summary

Securing Mesos

Enabling and configuring authentication

Enabling authentication

Choosing authenticators

Creating a file with a principal secret

Configuring agents

Configuring Marathon

Enabling secured socket layer security

Generating marathon.jks file

Adding marathon.jks file in configuration

Summary

Managing Resources in Mesos

Marathon-LB

Installing Marathon-LB

Implementing the blue/green deployment with Marathon-LB

Deploying an Apache web server

Zero-downtime deployment (ZDD)

What is Cassandra?

Deploying of a Cassandra cluster

Failover mechanism

Summary

Another Book You May Enjoy

Leave a review - let other readers know what you think

Preface

Apache Mesos is an open source cluster manager that provides efficient resource isolation and sharing across distributed applications. Learn Apache Mesos dives straight into how Mesos works. You will be introduced to distributed systems and their challenges, and then understand 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.

You will learn how Mesos works and then develop applications. You will learn to make full use of machines and simplify the maintenance of a data center with Mesos.

Who this book is for

This book is for DevOps, data engineers, and administrators who work with large data clusters. You'll also find this book useful if you have experience of working with virtualization, databases, and platforms such as Hadoop and Spark. Some experience in database administration and design will help you get the most out of this book.

What this book covers

Chapter 1, Deploying Apache Mesos on AWS, contains an overview of the Mesos architecture and how Mesos helps different teams to enhance their performance and deliver on it.

Chapter 2, Setting up Mesos Single-Cluster Nodes, explains how to set up AWS servers and how to deploy Mesos and its components.

Chapter 3, Installation of Mesosphere, explores the components that comprise a Mesos cluster.

Chapter 4, Apache Mesos Administration, explains how Mesos schedules resources, and how its allocation module offers those resources to various frameworks.

Chapter 5, Deploying Services on Mesos Cluster, shows how to start working on a Mesos cluster and how to deploy applications.

Chapter 6, Persistent Volumes, explains how to set up and use SSL to protect important endpoints. It also explains how to choose suitable authentication mechanisms.

Chapter 7, Securing Mesos, explains how to debug and troubleshoot the services and workloads on a Mesos cluster.

Chapter 8, Managing Resources in Mesos, explains how to manage CPU, memory, and disk resources in a Mesos environment.

To get the most out of this book

For this book, you will require a prior basic knowledge of SSH, AWS, and Mesos, and you will also require an AWS subscription.

Download the example code files

You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packt.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

Log in or register at

www.packt.com

.

Select the

SUPPORT

tab.

Click on

Code Downloads & Errata

.

Enter the name of the book in the

Search

box and follow the onscreen instructions.

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 athttps://github.com/PacktPublishing/Learn-Apache-Mesos. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available athttps://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: http://www.packtpub.com/sites/default/files/downloads/9781789137385_ColorImages.pdf.

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "So, we will give 10.0.0.0/16. Keep the IPv6 CIDR block as default."

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

Ssh -I "mesos.pem" [email protected]

Bold: Indicates a new term, an important word, or words that you see on screen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Set Tenancy as Default."

Warnings or important notes appear like this.
Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packt.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packt.com.

Deploying Apache Mesos on AWS

In the IT world today, some of the types of applications being developed cannot survive on a single computer. This is because these applications are accessed by a large number of users. Also, different types of applications means different platforms, such as Java and .NET.

Apache Mesos is a concentrated fault-tolerant cluster-management tool that is used for distributed computing environments that provides resource-isolation and management across a cluster of slave nodes.It efficiently manages the CPU memory and disk resources across the cluster, schedules the resources according to requirements, and deploys the apps. It is a highly available master through Apache ZooKeeper.

Apart from this, Apache Mesos also provides features such as application scheduling, scaling, faulttolerance, and cellfilling. It also supplies an application service discovery tool.

In this chapter, we will cover the following topics:

Installation and configuration of a highly available cluster in Apache Mesos

Setting the failure configuration in case the master nodes go down

Setting up a Mesos slave server to handle the Docker-related tasks, which are scheduled by Marathon

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 providethese 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.

Introduction to Amazon Web Service (AWS)

AWS is a secured cloud service platform that offers computing power. This is where we can run an EC2 instance for our master and slave, and then for the Marathon framework. It offers database storage as well.

We will use a MySQL database that offers more functionality to help the environment scale and grow.

AWS environment

For creating a VPC, EC2 instance, security groups, and load-balancers, perform the following steps:

Create a Virtual Private Cloud:

Create an EC2 instance: two for Marathon, three for Mesos master servers, and three for the Mesos slave servers:

Install the Mesos master application, Marathon:

Install ZooKeeper:

Insert Docker to run Docker images on all the slave servers. We will install the Mesos slave as well:

Use Marathon to deploy the application, and those tasks will launch on slave servers. We will use a WordPress Docker container:

Also, we will see how to load-balance Marathon and Mesos master servers. This will help to manage the Mesos UI and Marathon UI. It is not necessary to go every time on each Marathon server as the load-balancer will take care of that. If one of the master servers is down, it will redirect to another one, so this is where your management will become easy:

Use Marathon-lb HAProxy to load-balance your application request:

This was a quick overview of what we are going to cover in the upcoming chapters.

Summary

In this chapter, we explored the components of Apache Mesos. We also went through the overall architecture of Mesos. Then we covered the procedure of setting up an AWS environment.

In the next chapter, we will learn how to set up a Mesos single-cluster node. We will discuss some of the considerations in setting up a development environment. We will also use minimum server to deploy Mesos components for development purposes to build a development environment for Mesos using a Mesos single-cluster node setup.

Setting up Mesos Single-Cluster Nodes

In this chapter, we will discuss some of the considerations for setting up a development environment. The minimum server is used to deploy Mesos components for development purposes.

Our intention here is to build a development environment for Mesos by using a Mesos single-cluster-node setup, along with installing and configuring Mesos components on a single node, in the following order:

Setting up servers on AWS

Adding the Mesosphere repository in CentOS

Installing a single instance of ZooKeeper

Installing Mesos master services

Installing Mesos slave services

Installing the Docker engine

Installing Marathon

Deploying a sample application

Enabling inbound traffic using security groups to access Mesos and the Marathon console

Setup of servers on AWS

To deploy Apache Mesos and the pertinent components, we need servers where we can install these components. So, in this module, we will work on creating EC2 instances on AWS.

To deploy Mesos on AWS, we should have a Virtual Private Cloud (VPC), a subnet, in order to launch our instances inside different subnets as per our requirements, a route table where our instances can communicate with each other, and an internet gateway for public access, and then we will create the EC2 instances. After the creation of EC2 instances, we will deploy our Mesos software and their components.

Before we start with EC2 instances, let's understand the architecture of our system. The following diagram shows the architecture in which we are working on AWS and creating a VPC. Now we will create the EC2 instance, which will have two Marathon servers and three Mesos master servers along with Mesos slave servers. This will be around eight servers where Mesos will be installed.

Let's get started by setting up the AWS servers.

Creating a VPC on AWS

In order to set up servers on AWS, perform the following steps:

Log in to your AWS console and click on Your VPCs.

In order to create a new one, click on

Create VPC

and name it

Mesos

(since we are working on installing Mesos). Provide a IP in CIDR block text. The CIDR block is the range of the IP address that we want to create the subnet of, and then on each subnet we will have own IP address that our instances can use when launched in each subnet. So, we will put

10.0.0.0/16

. Keep the IPv6 CIDR block as the default and set

Tenancy

as

Default

. Here, default means resources can run on shared hardware. As you are running on shared hardware, Amazon provides complete security for your VPC. Click on

Yes, Create

:

The following screenshot shows the created VPC:

Our next step will be to create subnets.

Creating subnets

Subnets contain the instance resource and will have their own IP address ranges. So, when creating subnets, you should know how you will leverage the AWS availability zone. This will help us to create a reliable and available infrastructure for our application. In order to create the subnets, perform the following steps:

Click on the

Subnets

tab present at the sidebar. Set the

Name tag

as

10.0.1.0-mesos

; this will help us to identify our subnet easily. Then we will select our VPC, which was created earlier, as shown:

Create the availability zone. On selecting the drop-down, you can see there are six different availability zones. Here, we can create highly available servers on AWS, that is,

us-east-1a

.

Select the CIDR block that will be our IP range:

10.0.1.0/24

. By giving this IP address, our subnet will have IP address from

10.0.0.1

,

1.1

,

1.2

,

1.3

, and so on. Click

Yes, Create

to create the subnet.

Create one more subnet by clicking the

Create Subnet

tab and set the

Name tag

as

10.0.2.0 - mesos

, select the VPC, set the availability zone as

us-east-1b