- 146 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
Apache Mesos Cookbook
About This Book
Over 50 recipes on the core features of Apache Mesos and running big data frameworks in MesosAbout This Book• Learn to install and configure Mesos to suit the needs of your organization• Follow step-by-step instructions to deploy application frameworks on top of Mesos, saving you many hours of research and trial and error• Use this practical guide packed with powerful recipes to implement Mesos and easily integrate it with other application frameworksWho This Book Is ForThis book is for system administrators, engineers, and big data programmers. Basic experience with big data technologies such as Hadoop or Spark would be useful but is not essential. A working knowledge of Apache Mesos is expected.What You Will Learn• Set up Mesos on different operating systems• Use the Marathon and Chronos frameworks to manage multiple applications• Work with Mesos and Docker• Integrate Mesos with Spark and other big data frameworks• Use networking features in Mesos for effective communication between containers• Configure Mesos for high availability using Zookeeper• Secure your Mesos clusters with SASL and Authorization ACLs• Solve everyday problems and discover the best practicesIn DetailApache Mesos is open source cluster sharing and management software. Deploying and managing scalable applications in large-scale clustered environments can be difficult, but Apache Mesos makes it easier with efficient resource isolation and sharing across application frameworks.The goal of this book is to guide you through the practical implementation of the Mesos core along with a number of Mesos supported frameworks. You will begin by installing Mesos and then learn how to configure clusters and maintain them. You will also see how to deploy a cluster in a production environment with high availability using Zookeeper.Next, you will get to grips with using Mesos, Marathon, and Docker to build and deploy a PaaS. You will see how to schedule jobs with Chronos. We'll demonstrate how to integrate Mesos with big data frameworks such as Spark, Hadoop, and Storm. Practical solutions backed with clear examples will also show you how to deploy elastic big data jobs.You will find out how to deploy a scalable continuous integration and delivery system on Mesos with Jenkins. Finally, you will configure and deploy a highly scalable distributed search engine with ElasticSearch.Throughout the course of this book, you will get to know tips and tricks along with best practices to follow when working with Mesos.Style and approachThis step-by-step guide is packed with powerful recipes on using Apache Mesos and shows its integration with containers and big data frameworks.
Frequently asked questions
Information
Understanding the Scheduler API
- Installing Protobuf
- Registering frameworks
- Handling events
- Declining offers
- Scheduling tasks
- Acknowledging task updates
- Killing tasks
- State persistence
- Reconciliation
Introduction
Installing Protobuf
Getting ready
sudo add-apt-repository ppa:ubuntu-lxc/lxd-stable
sudo apt-get update
sudo apt-get install golang git
export GOPATH=~/go
export PATH=$PATH:$GOPATH/bin
sudo apt-get install protobuf-compiler
go get -u github.com/golang/protobuf/{proto,protoc-gen-go}
How to do it...
- Create a project directory and go there:
mkdir -p $GOPATH/src/simple-scheduler
cd $GOPATH/src/simple-scheduler
- Download the Mesos protobuf message definitions:
wget https://raw.githubusercontent.com/apache/mesos/170ac/include/mesos/v1/mesos.proto
wget https://raw.githubusercontent.com/apache/mesos/170ac/include/mesos/v1/scheduler/scheduler.proto
- Tweak them to our needs. Change the default package of generated bindings to one that matches Golang. We will keep the whole project in one main package and the generated bindings should fit in it. To make this, apply the following patches to scheduler.proto and mesos.proto:
cat <<EOF | patch
--- mesos.proto 2016-07-28 00:39:01.644273001 +0200
+++ mesos.proto 2016-08-08 22:16:37.112678075 +0200
@@ -18,6 +18,7 @@
option java_package = "org.apache.mesos.v1";
option java_outer_classname = "Protos";
+option go_package = "main";
/**
EOF
cat <<EOF | patch
--- scheduler.proto 2016-08-08 22:16:30.372706543 +0200
+++ scheduler.proto 2016-07-28 00:39:39.244296938 +0200
@@ -14,12 +14,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-import "mesos/v1/mesos.proto";
+import "mesos.proto";
-package mesos.v1.scheduler;
+package mesos.v1;
option java_package = "org.apache.mesos.v1.scheduler";
option java_outer_classname = "Protos";
+option go_package = "main";
/**
EOF
- Generate bindings for Mesos Protobuf messages:
protoc --go_out=. *.proto
- As a result, the working directory should have the following content:
mesos.pb.go mesos.proto scheduler.pb.go scheduler.proto
- And when we try to build the project with go build, we should get the following error:
# github.com/janisz/mesos-cookbook/4_understanding_frameworks
runtime.main: call to external function main.main
runtime.main: main.main: not defined
runtime.main: undefined: main.main
How it works...
Registering frameworks
How to do it...
import (
"bufio"
"bytes"
"log"
"net/http"
"os"
"strconv"
"strings"
"github.com/golang/protobuf/jsonpb"
)
// Url to Mesos master scheduler API
con...
Table of contents
- Title Page
- Copyright
- Credits
- About the Authors
- About the Reviewer
- www.PacktPub.com
- Customer Feedback
- Preface
- Getting Started with Apache Mesos
- Implementing High Availability with Apache ZooKeeper
- Running and Maintaining Mesos
- Understanding the Scheduler API
- Managing Containers
- Deploying PaaS with Marathon
- Job Scheduling with Metronome
- Continuous Integration with Jenkins