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
230
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
93
ArchieML
maciejb
0
120
I code for Warsaw
maciejb
0
190
Warsaw JUG: Listen to the sounds of your application
maciejb
0
140
Poznań JUG: Listen to the sounds of your application
maciejb
0
65
JVM GCs and why should I care?
maciejb
0
62
Other Decks in Programming
See All in Programming
AmperとFleetを使ったAndroidアプリ
yoppie
0
270
Snowflakeで眠ったデータを起こそう!
estie
0
160
Balkan Ruby 2024 — How and why to run SQLite on Rails in production
fractaledmind
0
100
Node.js v22 で変わること
yosuke_furukawa
PRO
12
4k
CDKコントリビュートの最初の壁を越えよう! -簡単issueの見つけ方-
badmintoncryer
3
260
Site Reliability Engineering for GMO
pyama86
9
1.1k
Domain-Driven Transformation
hschwentner
2
1.5k
サイコロで理解する統計的仮説検定の考え方
tatamiya
4
1.1k
Ruby GitHub Packages
bkuhlmann
0
650
GraphQLサーバの構成要素を整理する #ハッカー鮨 #tsukijigraphql / graphql server technology selection
izumin5210
4
920
JavaScript Closure
asoluka
0
600
はてなにおける CSS Modules、及び CSS Modules に足りないもの / CSS Modules in Hatena, and CSS Modules missing parts
mizdra
7
990
Featured
See All Featured
VelocityConf: Rendering Performance Case Studies
addyosmani
321
23k
Designing the Hi-DPI Web
ddemaree
276
33k
Building Your Own Lightsaber
phodgson
100
5.7k
Side Projects
sachag
451
41k
Bash Introduction
62gerente
605
210k
Ruby is Unlike a Banana
tanoku
96
10k
Being A Developer After 40
akosma
67
580k
The MySQL Ecosystem @ GitHub 2015
samlambert
244
12k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
22
1.6k
WebSockets: Embracing the real-time Web
robhawkes
59
7k
The Cost Of JavaScript in 2023
addyosmani
21
3.9k
Designing for Performance
lara
601
67k
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!