title 44pt sentence case running mesos/marathon on … mesos/marathon on arm servers yuqi gu...

15
© ARM 2017 Running Mesos/Marathon on ARM Servers Yuqi Gu MesosCon Asia, Beijing Senior Software Engineer Jun 22, 2017

Upload: phungduong

Post on 26-Mar-2018

218 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Title 44pt sentence case Running Mesos/Marathon on … Mesos/Marathon on ARM Servers Yuqi Gu MesosConAsia, ... #Install Django ... #Copy Web Server Configuration and static files

Title 44pt sentence case

Affiliations 24pt sentence case

20pt sentence case

© ARM 2017

Running Mesos/Marathon on ARM Servers

Yuqi Gu

MesosCon Asia, Beijing

Senior Software Engineer

Jun 22, 2017

Page 2: Title 44pt sentence case Running Mesos/Marathon on … Mesos/Marathon on ARM Servers Yuqi Gu MesosConAsia, ... #Install Django ... #Copy Web Server Configuration and static files

© ARM 2017 2

Title 40pt sentence case

Bullets 24pt sentence case

bullets 20pt sentence case

Agenda

▪ Why run Mesos on AArch64?

▪ How to setup a Mesos/Marathon cluster on AArch64?

▪ Demo - Deploy and Scale the containerized Apps by Mesos/Marathon on ARM cluster

© ARM ltd

Page 3: Title 44pt sentence case Running Mesos/Marathon on … Mesos/Marathon on ARM Servers Yuqi Gu MesosConAsia, ... #Install Django ... #Copy Web Server Configuration and static files

© ARM 2017 3

Title 40pt sentence case

Bullets 24pt sentence case

bullets 20pt sentence case

Why run Mesos on AArch64?

▪ What is “AArch64” ?

AArch64 was introduced in ARMv8-A, which was announced in October 2011.

ARMv8-A adds an optional 64-bit architecture named "AArch64“.

AArch64 cores(Cortex-A53 & Cortex-A57) were announced on 30 October 2012.

▪ Distros supporting AArch64

Page 4: Title 44pt sentence case Running Mesos/Marathon on … Mesos/Marathon on ARM Servers Yuqi Gu MesosConAsia, ... #Install Django ... #Copy Web Server Configuration and static files

© ARM 2017 4

Title 40pt sentence case

Bullets 24pt sentence case

bullets 20pt sentence case

Why run Mesos on AArch64?

▪ ARM Solution Benefits

▪ Lower cost

▪ Multi cores and instructions executed in parallel

▪ Allow power headroom to be specialized

▪ Power efficiency

Page 5: Title 44pt sentence case Running Mesos/Marathon on … Mesos/Marathon on ARM Servers Yuqi Gu MesosConAsia, ... #Install Django ... #Copy Web Server Configuration and static files

© ARM 2017 5

Title 40pt sentence case

Bullets 24pt sentence case

bullets 20pt sentence case

A Mesos-Marathon cluster looks like …Zookeeper

Quorum

(leader)

Marathon: Container Orchestration Platform for Mesos

Mesos Slave1

Docker…

Mesos Master

Zookeeper

(Primary)

Mesos Master

Zookeeper

(Standby)

Mesos Master

Zookeeper

(Standby)

Mesos Slave2

Docker…

Mesos Slave3

Docker…

Mesos SlaveN

Docker…

. . .

Page 6: Title 44pt sentence case Running Mesos/Marathon on … Mesos/Marathon on ARM Servers Yuqi Gu MesosConAsia, ... #Install Django ... #Copy Web Server Configuration and static files

© ARM 2017 6

Title 40pt sentence case

Bullets 24pt sentence case

bullets 20pt sentence case

How to Set up Mesos/Marathon on AArch64

3rd party NoAArch64 Support AArch64 Support

Protobuf 2.5.0 2.6.1 +

ZooKeeper 3.4.7 3.4.8 +

Libev 4.15 4.22 +

Leveldb 1.4 1.19 +

▪ Build Mesos/Marathon packages for AArch64 on Ubuntu

▪ The build steps on AArch64 are similar with those on other platforms. Except:

Glog0.3.3

Error log: Configure error:

cannot guess build type

Solution: ➢ update ‘config.guess’ for

AArch64

Upgrade Mesos 3rd party modules for

Fix build issues for

Page 7: Title 44pt sentence case Running Mesos/Marathon on … Mesos/Marathon on ARM Servers Yuqi Gu MesosConAsia, ... #Install Django ... #Copy Web Server Configuration and static files

© ARM 2017 7

Title 40pt sentence case

Bullets 24pt sentence case

bullets 20pt sentence case

How to Set up Mesos/Marathon on AArch64

▪ Install/Configure Mesos agent/zookeeper/marathon on Master

▪ Install/Configure Mesos agent/docker on Slaves

▪ Launch services respectivelyM

eso

sM

aste

r Mesos-master-service

Zookeeper-service

Marathon-framework

Meso

sSl

aves Mesos-slave-

service

Docker-daemon

Apps…

Ubuntu 16.04.2 LTS Ubuntu 16.04.2 LTS

Page 8: Title 44pt sentence case Running Mesos/Marathon on … Mesos/Marathon on ARM Servers Yuqi Gu MesosConAsia, ... #Install Django ... #Copy Web Server Configuration and static files

© ARM 2017 8

Title 40pt sentence case

Bullets 24pt sentence case

bullets 20pt sentence case

Mesos/Marathon Cluster in Demo

Bare-Metal Machine

Master

(VM)

Slave#1

(VM)

Slave#2

(VM)

Mesos(Distributed resources: CPU, RAM, I/O, disk, etc.)

Marathon framework

App App App AppApp

a single pool of resources

Slave2

Slave1master

Page 9: Title 44pt sentence case Running Mesos/Marathon on … Mesos/Marathon on ARM Servers Yuqi Gu MesosConAsia, ... #Install Django ... #Copy Web Server Configuration and static files

© ARM 2017 9

Title 40pt sentence case

Bullets 24pt sentence case

bullets 20pt sentence case

Containerized Applications on Mesos/Marathon Cluster

web server1

Browser MARATHON

web server1

Page 10: Title 44pt sentence case Running Mesos/Marathon on … Mesos/Marathon on ARM Servers Yuqi Gu MesosConAsia, ... #Install Django ... #Copy Web Server Configuration and static files

© ARM 2017 10

Title 40pt sentence case

Bullets 24pt sentence case

bullets 20pt sentence case

Dock

er

Imag

e

Dock

er Im

age

port mapping

Build AARCH64

Images

Containerized applications on Mesos/Marathon Cluster

Web

server

31479

Haproxy

Dock

er Im

age

Web

server

8080

31975

80

31933

8080

Page 11: Title 44pt sentence case Running Mesos/Marathon on … Mesos/Marathon on ARM Servers Yuqi Gu MesosConAsia, ... #Install Django ... #Copy Web Server Configuration and static files

© ARM 2017 11

Title 40pt sentence case

Bullets 24pt sentence case

bullets 20pt sentence case FROM ubuntu/developer

RUN apt-get update \

&& apt-get -y dist-upgrade \

&& apt-get install -y python3-pip

RUN pip3 install --upgrade pip

#Install Django

RUN pip3 install Django

WORKDIR /home/ent-user

COPY django-show.sh ./

COPY prj_urls.py ./

COPY show_views.py ./

COPY demo-show.html ./

COPY prj_context_processor.py ./

RUN mkdir -p /home/ent-user/static-data

ADD static-data /home/ent-user/static-data

#Web server default port

ENV EX_PORT 12580

# Run Initialized Script

CMD ["/bin/bash", "/home/ent-user/django-

show.sh" ]

Build Django images on AArch64

# Start project

django-admin startproject $PRJ_NAME

cd $PRJ_DIRpython manage.py startapp $APP_NAME

#Config Django

sed -i '28a ALLOWED_HOSTS = ["*"]'

$PRJ_DIR/$PRJ_NAME/settings.py

sed -i '28d' $PRJ_DIR/$PRJ_NAME/settings.py

sed -i '64a "demosite.context_processor.ip_address", '

$PRJ_DIR/$PRJ_NAME/settings.py

sed -i '39a "show",' $PRJ_DIR/$PRJ_NAME/settings.py

#Copy Web Server Configuration and static files

cp -af $TOP/show_views.py $APP_DIR/views.py

cp -af $TOP/prj_urls.py $PRJ_DIR/$PRJ_NAME/urls.py

cp -af $TOP/prj_context_processor.py

$PRJ_DIR/$PRJ_NAME/context_processor.py

cd $APP_DIR

mkdir static templates

cp -af $TOP/demo-show.html $APP_DIR/templates/demo-show.html

cp -af $TOP/static-data/* $APP_DIR/static/

# Start server

cd $PRJ_DIR

python manage.py runserver 0:$EX_PORT

Scripts

Build AArch64 Docker Images and Customize Initialized Scripts

Customize Initialized Scripts

Dockerfile

Page 12: Title 44pt sentence case Running Mesos/Marathon on … Mesos/Marathon on ARM Servers Yuqi Gu MesosConAsia, ... #Install Django ... #Copy Web Server Configuration and static files

© ARM 2017 12

Title 40pt sentence case

Bullets 24pt sentence case

bullets 20pt sentence case

FROM ubuntu/developer

#Install haproxy

RUN apt-get update \

&& apt-get install -y haproxy

# Default Ports for Haproxy

# backend servers

ENV SRV1_PORT 31000

ENV SRV2_PORT 32000

WORKDIR /home/ent-user

COPY haproxy.cfg ./

# Run Initialized Script

COPY haproxy-run.sh ./

CMD ["/bin/bash", "/home/ent-user/haproxy-

run.sh"]

Build HAproxy images on AArch64

#!/bin/bash

TOP=`pwd`

#Config HAproxy

mkdir /run/haproxy

cp -af haproxy.cfg /etc/haproxy/haproxy.cfg

sed -i '/$/a ENABLED=1' /etc/default/haproxy

#haproxy backend servers Ports

sed -i "/#mytag/ a server server1 mesos-

slave1.shanghai.arm.com:${SRV1_PORT}\nserver server2

mesos-slave2.shanghai.arm.com:${SRV2_PORT}"

/etc/haproxy/haproxy.cfg

haproxy -f /etc/haproxy/haproxy.cfg

service haproxy start

Scripts

Build AArch64 Docker Images and Customize Initialized Scripts

Customize Initialized Scripts

Dockerfile

Page 13: Title 44pt sentence case Running Mesos/Marathon on … Mesos/Marathon on ARM Servers Yuqi Gu MesosConAsia, ... #Install Django ... #Copy Web Server Configuration and static files

© ARM 2017 13

Title 40pt sentence case

Bullets 24pt sentence case

bullets 20pt sentence case

Page 14: Title 44pt sentence case Running Mesos/Marathon on … Mesos/Marathon on ARM Servers Yuqi Gu MesosConAsia, ... #Install Django ... #Copy Web Server Configuration and static files

© ARM 2017 14

Title 40pt sentence case

Bullets 24pt sentence case

bullets 20pt sentence case

Page 15: Title 44pt sentence case Running Mesos/Marathon on … Mesos/Marathon on ARM Servers Yuqi Gu MesosConAsia, ... #Install Django ... #Copy Web Server Configuration and static files

The trademarks featured in this presentation are registered and/or unregistered trademarks of ARM Limited

(or its subsidiaries) in the US and/or elsewhere. All rights reserved. All other marks featured may be

trademarks of their respective owners.

Copyright © 2017 ARM Limited

© ARM 2017