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
250
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
100
ArchieML
maciejb
0
140
I code for Warsaw
maciejb
0
200
Warsaw JUG: Listen to the sounds of your application
maciejb
0
150
Poznań JUG: Listen to the sounds of your application
maciejb
0
78
JVM GCs and why should I care?
maciejb
0
67
Other Decks in Programming
See All in Programming
Is Xcode slowly dying out in 2025?
uetyo
1
220
来たるべき 8.0 に備えて React 19 新機能と React Router 固有機能の取捨選択とすり合わせを考える
oukayuka
2
870
NPOでのDevinの活用
codeforeveryone
0
460
Rubyでやりたい駆動開発 / Ruby driven development
chobishiba
1
490
PHP 8.4の新機能「プロパティフック」から学ぶオブジェクト指向設計とリスコフの置換原則
kentaroutakeda
2
670
0626 Findy Product Manager LT Night_高田スライド_speaker deck用
mana_takada
0
130
Create a website using Spatial Web
akkeylab
0
310
なぜ「共通化」を考え、失敗を繰り返すのか
rinchoku
1
600
Hypervel - A Coroutine Framework for Laravel Artisans
albertcht
1
110
既存デザインを変更せずにタップ領域を広げる方法
tahia910
1
240
第9回 情シス転職ミートアップ 株式会社IVRy(アイブリー)の紹介
ivry_presentationmaterials
1
250
Modern Angular with Signals and Signal Store:New Rules for Your Architecture @enterJS Advanced Angular Day 2025
manfredsteyer
PRO
0
150
Featured
See All Featured
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
124
52k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
48
5.4k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
A Tale of Four Properties
chriscoyier
160
23k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
GraphQLとの向き合い方2022年版
quramy
49
14k
Fireside Chat
paigeccino
37
3.5k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
800
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
BBQ
matthewcrist
89
9.7k
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!