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
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
78
JVM GCs and why should I care?
maciejb
0
67
Other Decks in Programming
See All in Programming
ASP. NET CoreにおけるWebAPIの最新情報
tomokusaba
0
360
パスキーのすべて ── 導入・UX設計・実装の紹介 / 20250213 パスキー開発者の集い
kuralab
3
670
iOSエンジニアから始める visionOS アプリ開発
nao_randd
3
120
2024年のWebフロントエンドのふりかえりと2025年
sakito
1
230
2,500万ユーザーを支えるSREチームの6年間のスクラムのカイゼン
honmarkhunt
6
5.1k
チームリードになって変わったこと
isaka1022
0
190
Bedrock Agentsレスポンス解析によるAgentのOps
licux
2
720
Spring gRPC について / About Spring gRPC
mackey0225
0
220
CloudNativePGがCNCF Sandboxプロジェクトになったぞ! 〜CloudNativePGの仕組みの紹介〜
nnaka2992
0
220
AWS Organizations で実現する、 マルチ AWS アカウントのルートユーザー管理からの脱却
atpons
0
130
Writing documentation can be fun with plugin system
okuramasafumi
0
120
Amazon Bedrock Multi Agentsを試してきた
tm2
1
280
Featured
See All Featured
Speed Design
sergeychernyshev
25
780
The Cult of Friendly URLs
andyhume
78
6.2k
Mobile First: as difficult as doing things right
swwweet
223
9.3k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Documentation Writing (for coders)
carmenintech
67
4.6k
Gamification - CAS2011
davidbonilla
80
5.1k
Making the Leap to Tech Lead
cromwellryan
133
9.1k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.1k
Typedesign – Prime Four
hannesfritz
40
2.5k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
29
4.6k
How STYLIGHT went responsive
nonsquared
98
5.3k
Done Done
chrislema
182
16k
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!