Clouds, leicht beherrschbar

43
Clouds, leicht beherrschbar

description

Vortrag der OOP 2014 Ein Einstieg in die Software Juju für das Provisioning und die Konfiguration von Clouds sowie ein Überblick über Architekturaspekte.

Transcript of Clouds, leicht beherrschbar

Page 1: Clouds, leicht beherrschbar

Clouds, leicht beherrschbar

Page 2: Clouds, leicht beherrschbar

Frank Müller

Oldenburg Baujahr 1965

Entwickler Fachautor

!

[email protected] @themue

Page 3: Clouds, leicht beherrschbar

Was sind Clouds?

Page 4: Clouds, leicht beherrschbar

Bereitgestellte Infrastruktur …

Page 5: Clouds, leicht beherrschbar

… ist nichts ohne bereitgestellteDienste

Page 6: Clouds, leicht beherrschbar

mysql

wordpressBekanntes

Szenario auf

individuellen Servern

Page 7: Clouds, leicht beherrschbar

Mehr Komplexität in Clouds

wordpress

mediawikihaproxy-w mediawiki memcached

haproxy-b

wordpress mysql

wordpressvarnish

Page 8: Clouds, leicht beherrschbar

Ein mühsamer Weg

Page 9: Clouds, leicht beherrschbar

Juju - Open Source Tool zur Automatisierung von Clouds

http://juju.ubuntu.com

Page 10: Clouds, leicht beherrschbar

Plattformen

Page 11: Clouds, leicht beherrschbar

Plattformen

EC2 OpenStack HP Cloud Azure ...

wordpress

mediawikihaproxy-w mediawiki memcached

haproxy-b

wordpress mysql

wordpressvarnish

Page 12: Clouds, leicht beherrschbar

Provisionierung

Page 13: Clouds, leicht beherrschbar

Bootstrapping

juju init juju bootstrap

Bootstrap

Page 14: Clouds, leicht beherrschbar

Zentrale Funktionen

Bootstrap

State

API

Provisioner

...

Page 15: Clouds, leicht beherrschbar

Service Deployment

juju deploy juju-gui juju deploy wordpress juju deploy mysql juju expose juju-gui

Bootstrap

juju-gui wordpress mysql

Page 16: Clouds, leicht beherrschbar

Relationen

Page 17: Clouds, leicht beherrschbar

Services verknüpfen

juju add-relation wordpress mysql juju expose wordpress

Bootstrap

juju-gui wordpress mysql

Page 18: Clouds, leicht beherrschbar

Konfiguration

Page 19: Clouds, leicht beherrschbar

Konfigurieren

juju set mysql dataset-size=50% juju set wordpress tuning=optimized

Bootstrap

juju-gui wordpress* mysql*

Page 20: Clouds, leicht beherrschbar

Skalieren

Page 21: Clouds, leicht beherrschbar

Skalieren

juju deploy memcached juju add-relation wordpress memcached juju add-unit wordpress

wordpress*

Bootstrap

juju-gui wordpress* mysql*

memcached

Page 22: Clouds, leicht beherrschbar

Varianten

Page 23: Clouds, leicht beherrschbar

Wie viele Units pro Maschine?

ContainerDirekte AbhängigkeitStandard

Unit

Unit

Unter- geordnete

Unit

Unit

Unit

Unit

Page 24: Clouds, leicht beherrschbar

Komfort als Geschenk

Page 25: Clouds, leicht beherrschbar

Juju GUI (1)

Page 26: Clouds, leicht beherrschbar

Juju GUI (2)

Page 27: Clouds, leicht beherrschbar

Charms

Page 28: Clouds, leicht beherrschbar

Charm-Bestandteile

Metadaten

Konfigurationsoptionen

Unit Hooks install / config-changed / start

upgrade-charm / stop

Relation Hooks x-relation-joined / x-relation-changed x-relation-departed / x-relation-broken

Bauplan aus

statischen und

dynamischen Bestandteilen

Page 29: Clouds, leicht beherrschbar

Vom Charm zur Unit

Individuelle Agenten Machiner / Uniter

Zentrale Agenten Provisioner / Firewaller

Unit

Charm

Page 30: Clouds, leicht beherrschbar

Einige Charms …

ceph

mediawiki mongodb

cassandra

rails

mysql

wordpressrabbitmq

haproxy

apache2

hadoop squid

hbase

couchdb

postgresqlnfsntp

Page 31: Clouds, leicht beherrschbar

Architektur

Page 32: Clouds, leicht beherrschbar

Implementierungin Google Go

Page 33: Clouds, leicht beherrschbar

State / API / Worker

State

Provisioner

GUI

CLI

Firewaller

Machiner

Deployer

Uniter

API!

Watcher- Sammlungen- Individuelle Objekte

- MongoDB- Zugriffsschicht

Page 34: Clouds, leicht beherrschbar

Ereigniskette

State

API!

CLI Worker

Worker

Worker

Page 35: Clouds, leicht beherrschbar

Bestandteile der API

Netz und Crypto

Reflection für Dispatching

WebSockets

Serialisierung via JSON

Page 36: Clouds, leicht beherrschbar

Nebenher und doch zusammen

Command / Agent

Worker

Worker

Goroutine Goroutine

Goroutine Goroutine

• Command / Agent abhängig

von Dateiname und

Argumenten

• Einsatz als individuelles

Kommando oder Daemon

• Verschiedene parallele Worker

je nach Command / Agent

• Goroutines (Google Go) für

nebenläufige Aufgaben

Page 37: Clouds, leicht beherrschbar

Beispiel: Firewaller

State

Main Loop

Machine LoopMachine Loop Unit LoopUnit Loop Service LoopService Loop

Environment Configuration

Machines

MachinesPorts

Exposes

Page 38: Clouds, leicht beherrschbar

Plattformen kapseln

Environment

EC2 OpenStack Azure MAAS

EC2 OpenStack Azure MAAS

Command …Worker

Page 39: Clouds, leicht beherrschbar

Vom Umgang mit heißen Situationen

Page 40: Clouds, leicht beherrschbar

Strikte Fehlerkontrolle

• Keine Exceptions in Go

• Rückgabe von Fehlerwerten

• Kein Ignorieren von Fehlern

• launchpad.net/tomb für Fehler und Lebenszyklus von Goroutines

Page 41: Clouds, leicht beherrschbar

Wiederanlauf

• Soll-Zustand in State ist Master

• Nach Ausfall Abfrage des Soll-Zustands

• Abgleich mit Ist-Zustand

• Bei Abweichung Anpassung an Soll-Zustand

Page 42: Clouds, leicht beherrschbar

Viel Spaß in den Wolken

Page 43: Clouds, leicht beherrschbar

❝Zitat hier eingeben.

–Christian BauerBildquellen 123RFiStockphotoeigene Quellen