Post on 08-Feb-2017
1community.emccode.com
RUNNING STATEFUL SERVICES IN CONTAINERSJONAS ROSLAND, EMC {code}DEVELOPER ADVOCATE & COMMUNITY MANAGER
2community.emccode.com
• How are Container Platforms managed?• Handling stateless apps and stateful services• Everything running in containers• Making the platforms understand data persistence
AGENDA
3community.emccode.com
• Clustered servers• Manual deployments• Redundancy, not necessarily high availability
BACK IN THE OLD DAYS
4community.emccode.com
• Infrastructure as a Service• Deploy virtual machines• Manual/half-automated way of deploying apps• Almost efficient
THEN SOME TIME AGO
5community.emccode.com
• Collection of compute resources• Spread out horizontally• Brings scale to your deployments
NOW – CONTAINER PLATFORMS
6community.emccode.com
Standard definitions
7community.emccode.com
APPLICATIONS RUN IN CONTAINERS
Code Code andrequirements Container
8community.emccode.com
• Manages all physical/virtualresources• Deploys and schedules apps• Handles hardware failures
RESOURCE MANAGERS AND SCHEDULERS
9community.emccode.com
SCHEDULING
10community.emccode.com
PAAS SITS ON TOP OF SCHEDULERS
11community.emccode.com
• Enables apps and infrato automatically findparts of each other• Keeps track of how to
connect and use theapplication services
SERVICE DISCOVERY
12community.emccode.com
SERVICE DISCOVERY
Java App
2.3.4.5:8080 Where isJava App?2.3.4.5:8080
13community.emccode.com
You don’t have torewrite your apps!
14community.emccode.com
• Storing data (state) is a critical component of any application• Where they store this state defines their class
– Connected database– In memory– Local disk
APPLICATION STATE DIFFERENCES
15community.emccode.com
• Store no critical data locally• Can be scaled as needed• Recovers quickly
STATELESS APPLICATIONS
16community.emccode.com
• Services that store state• Have usually been treated as HA apps• Can be scale-out or scale-up
STATEFUL SERVICES
17community.emccode.com
FROM oraclelinux:latest
ENV PACKAGE_URL https://repo.mysql.com/yum/mysql-5.7-community/docker/x86_64/mysql-community-server-minimal-5.7.12-1.el7.x86_64.rpm
RUN rpmkeys --import http://repo.mysql.com/RPM-GPG-KEY-mysql && yum install -y $PACKAGE_URL && yum install -y libpwquality && rm -rf /var/cache/yum/*
RUN mkdir /docker-entrypoint-initdb.d
VOLUME /var/lib/mysql
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 3306 33060
CMD ["mysqld"]
MYSQL IN A CONTAINER
18community.emccode.com
APPLICATIONS BUILT FROM SERVICESFront End or Non-Persistent
Data Services (Persistent)
Scal
e-Up
Scale-Out
CassandraPostgresRedis CouchDB
Elastic SearchHadoop
MariaDB
Mysql
Nginx
HAProxy
MongoDB
RabbitMQTomcat
Memcached
ScaleIO ECS
ApacheRails
Language Specific HTTP
19community.emccode.com
• No!– Without proper storage mapped, the service will lose data– Data doesn’t travel with the service if it’s stored on local
disk• Yes!
– Automatically mapping modern storage backends delivered by EMC, AWS, GCE, OpenStack and othersenables your data to be stored safely
STATEFUL SERVICES IN CONTAINERS?
20community.emccode.com
21community.emccode.com
• Have been mostly focused on stateless apps• Working hard on making stateful services part of
their inventory• So how do you handle both types?
CONTAINER PLATFORMS
22community.emccode.com
• Data is stored outside the platform
EXAMPLE 1
23community.emccode.com
• Data is stored on the same platform
EXAMPLE 2
24community.emccode.com
Virtual Machine
PERSISTENCE AND P3
Platform 2 Platform 3
High Availability
Live Migration
Highly Available
Container Platform
Lifecycle Management
Container Platform
Lifecycle Management
26community.emccode.com
Making the platformunderstand storage
27community.emccode.com
• When a container starts, we can map storage to it• For apps such as databases this is a necessity• When a container stops, the storage is unmounted
and can be reused by another container
HOW DOES STORAGE IN CONTAINERS WORK?
28community.emccode.com
• Local storage locks the container’s data on one server• Using non-local storage gives us the possibility to
move containers across servers• Having that possibility is crucial for HA environments
WHY NOT USE LOCAL STORAGE?
29community.emccode.com
LET’S START WITH THE BASICS
GCE
?
AWSEMC OpenStack
30community.emccode.com
SAY HELLO TO MY LITTLE FRIEND – REX-RAY
31community.emccode.com
NOW WE’RE GETTING SOMEWHERE
GCEAWSEMC OpenStack
32community.emccode.com
AND NOW IT’S GETTING INTERESTING
GCEAWSEMC OpenStack
Mesos Kubernetes
33community.emccode.com
• Gives you the possibility to use any storage platform, and even multiple platforms at the same time• Always in sync with Docker’s development cycle• Integrated with Docker, Mesos and Kubernetes
REX-RAY BENEFITS
34© Copyright 2016 EMC Corporation. All rights reserved.
@EMCcode@jonasrosland
emccode.comcommunity.emccode.com
Questions?
35© Copyright 2016 EMC Corporation. All rights reserved. 35© Copyright 2016 EMC Corporation. All rights reserved.