Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
akka-cluster-etcd
Search
Maciej Biłas
April 16, 2016
Programming
0
240
akka-cluster-etcd
Presented at Scalar conference 2016
Maciej Biłas
April 16, 2016
Tweet
Share
More Decks by Maciej Biłas
See All by Maciej Biłas
Testing with Docker
maciejb
1
98
ArchieML
maciejb
0
130
I code for Warsaw
maciejb
0
190
Warsaw JUG: Listen to the sounds of your application
maciejb
0
150
Poznań JUG: Listen to the sounds of your application
maciejb
0
76
JVM GCs and why should I care?
maciejb
0
65
Other Decks in Programming
See All in Programming
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
110
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
430
Enabling DevOps and Team Topologies Through Architecture: Architecting for Fast Flow
cer
PRO
0
320
CSC509 Lecture 09
javiergs
PRO
0
140
ピラミッド、アイスクリームコーン、SMURF: 自動テストの最適バランスを求めて / Pyramid Ice-Cream-Cone and SMURF
twada
PRO
10
1.3k
Jakarta Concurrencyによる並行処理プログラミングの始め方 (JJUG CCC 2024 Fall)
tnagao7
1
290
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
330
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
2
660
.NET のための通信フレームワーク MagicOnion 入門 / Introduction to MagicOnion
mayuki
1
1.4k
AWS IaCの注目アップデート 2024年10月版
konokenj
3
3.3k
シールドクラスをはじめよう / Getting Started with Sealed Classes
mackey0225
4
640
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
280
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Visualization
eitanlees
145
15k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
506
140k
Gamification - CAS2011
davidbonilla
80
5k
Bash Introduction
62gerente
608
210k
How to train your dragon (web standard)
notwaldorf
88
5.7k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
How to Ace a Technical Interview
jacobian
276
23k
Transcript
akka-cluster-etcd Maciej Biłas
Who am I? • Maciej Biłas • Software engineer at
Adform • much data, some plumbing • Scala for ~4 years
Agenda • Application deployment • Akka Cluster construction • Deployment
demo
Application deployment a subjective point of view
A long time ago in a galaxy far, far away…
ftp://
A couple of years later…
The Old Way • Servers, VMs • Chefs, Ansibles, …
• System libraries, packages, … • logging, monitoring, … • Host-centric infrastructure
None
Forget about docker running on your host for a moment
… forget about hosts
think about containers
None
The New Way
+
Mesos + Marathon Kubernetes Docker Swarm +
Kubernetes • Resource utilisation • Self-healing • Horizontal scaling
Kubernetes • Where do my containers live? • What are
the IP addresses of their machines?
What about Akka Cluster?
What is Akka Cluster anyway? actors over the network
akka-cluster • fault-tolerant • decentralized • peer-to-peer
akka-cluster • fault-tolerant • decentralized • peer-to-peer
Seed nodes akka.cluster.seed-nodes = [ "akka.tcp://ClusterSystem@host1:2552", “akka.tcp://ClusterSystem@host2:2552" ]
akka-cluster-etcd • Service discovery • Akka Extension • github.com/rkrzewski/akka-cluster-etcd
Cluster discovery import pl.caltha.akka.cluster.ClusterDiscovery ClusterDiscovery(system).start()
etcd • /etc distributed • distributed key-value store • strongly-consistent
• Raft consensus protocol
akka.cluster { discovery.etcd { host = etcd port = 2379
} }
Deployment demo cluster-monitor application
+ Running an Akka Cluster on Kubernetes
None
Kubernetes • Replication controller • Service
gcloud container clusters create “hello-scalar” \ --machine-type=$MACHINE_TYPE \ --num-nodes=3
Deployment • etcd • cloud-monitor frontend • cloud-monitor backend
Deployment kubectl create -f etcd-rc.yml \ -f etcd-srv.yml \
-f frontend-rc.yml \ -f frontend-srv.yml \ -f backend-rc.yml
Deployment kubectl create -f etcd-rc.yml \ -f etcd-srv.yml \
-f frontend-rc.yml \ -f frontend-srv.yml \ -f backend-rc.yml
frontend-rc.yml apiVersion: v1 kind: ReplicationController metadata: name: cluster-monitor-frontend spec: replicas:
1 selector: app: cluster-monitor-frontend template: metadata: labels: app: cluster-monitor-frontend spec: containers: - name: cluster-monitor image: eu.gcr.io/sandbox-maciejb/akka-cluster-etcd/monitor:latest imagePullPolicy: IfNotPresent env: - name: CLUSTER_ROLE value: frontend
frontend-srv.yml apiVersion: v1 kind: Service metadata: name: cluster-monitor-frontend spec: ports:
- port: 8080 selector: app: cluster-monitor-frontend type: LoadBalancer
DEMO
DEMO BACKUP
None
Horizonal scaling
➜ kubectl get rc NAME DESIRED CURRENT AGE cloud-monitor-backend 1
1 9m cloud-monitor-frontend 1 1 9m etcd 1 1 15m ➜ kubectl scale rc/cloud-monitor-backend --replicas=3 replicationcontroller "cloud-monitor-backend" scaled
➜ kubectl get rc NAME DESIRED CURRENT AGE cloud-monitor-backend 1
1 9m cloud-monitor-frontend 1 1 9m etcd 1 1 15m ➜ kubectl scale rc/cloud-monitor-backend --replicas=3 replicationcontroller "cloud-monitor-backend" scaled
None
➜ kubectl scale rc/cloud-monitor-backend --replicas=2
None
Self-healing
➜ kubectl get pods NAME READY STATUS RESTARTS AGE cloud-monitor-backend-2zpds
1/1 Running 0 2m cloud-monitor-backend-cxj7r 1/1 Running 0 4m cloud-monitor-frontend-biw43 1/1 Running 0 3m etcd-tmpz6 1/1 Running 0 23m ➜ kubectl delete pods/cloud-monitor-backend-2zpds pod "cloud-monitor-backend-2zpds" deleted ➜ kubectl get pods NAME READY STATUS RESTARTS AGE cloud-monitor-backend-cxj7r 1/1 Running 0 5m cloud-monitor-backend-dqpvd 1/1 Running 0 20s cloud-monitor-frontend-biw43 1/1 Running 0 3m etcd-tmpz6 1/1 Running 0 24m
➜ kubectl get pods NAME READY STATUS RESTARTS AGE cloud-monitor-backend-2zpds
1/1 Running 0 2m cloud-monitor-backend-cxj7r 1/1 Running 0 4m cloud-monitor-frontend-biw43 1/1 Running 0 3m etcd-tmpz6 1/1 Running 0 23m ➜ kubectl delete pods/cloud-monitor-backend-2zpds pod "cloud-monitor-backend-2zpds" deleted ➜ kubectl get pods NAME READY STATUS RESTARTS AGE cloud-monitor-backend-cxj7r 1/1 Running 0 5m cloud-monitor-backend-dqpvd 1/1 Running 0 20s cloud-monitor-frontend-biw43 1/1 Running 0 3m etcd-tmpz6 1/1 Running 0 24m
➜ kubectl get pods NAME READY STATUS RESTARTS AGE cloud-monitor-backend-2zpds
1/1 Running 0 2m cloud-monitor-backend-cxj7r 1/1 Running 0 4m cloud-monitor-frontend-biw43 1/1 Running 0 3m etcd-tmpz6 1/1 Running 0 23m ➜ kubectl delete pods/cloud-monitor-backend-2zpds pod "cloud-monitor-backend-2zpds" deleted ➜ kubectl get pods NAME READY STATUS RESTARTS AGE cloud-monitor-backend-cxj7r 1/1 Running 0 5m cloud-monitor-backend-dqpvd 1/1 Running 0 20s cloud-monitor-frontend-biw43 1/1 Running 0 3m etcd-tmpz6 1/1 Running 0 24m
➜ kubectl get pods NAME READY STATUS RESTARTS AGE cloud-monitor-backend-2zpds
1/1 Running 0 2m cloud-monitor-backend-cxj7r 1/1 Running 0 4m cloud-monitor-frontend-biw43 1/1 Running 0 3m etcd-tmpz6 1/1 Running 0 23m ➜ kubectl delete pods/cloud-monitor-backend-2zpds pod "cloud-monitor-backend-2zpds" deleted ➜ kubectl get pods NAME READY STATUS RESTARTS AGE cloud-monitor-backend-cxj7r 1/1 Running 0 5m cloud-monitor-backend-dqpvd 1/1 Running 0 20s cloud-monitor-frontend-biw43 1/1 Running 0 3m etcd-tmpz6 1/1 Running 0 24m
Recap • Application deployment • akka-cluster + etcd • Kubernetes
Q&A
Thank you!