SlideShare a Scribd company logo
Consul 
-­‐ 
Service 
discovery 
and 
others 
By 
Walter 
Liu 
2014/11/11
Similar 
services 
• Consul 
• SkyDNS 
• Others 
• Zookeeper 
• etcd 
• Serf
What’s 
Consul? 
• Service 
Discovery 
• DNS 
• HTTP 
(JSON) 
• Health 
Checking 
(Service 
Discovery 
need 
this) 
• Key/Value 
Store 
• dynamic 
configuraMon 
• feature 
flagging 
• coordinaMon 
• leader 
elecMon 
• (Very 
like 
the 
funcMonality 
of 
Zookeeper 
we 
used) 
• MulM 
Datacenter 
• Network 
parMMon 
• If 
one 
DC 
off, 
no 
impact 
to 
another 
DC. 
• Data 
duplicate 
to 
another 
DC 
automaMcally.
User 
Scenarios 
in 
Our 
Infra 
• Simplify 
config 
(even 
with 
SaltStack) 
• Dynamic 
server 
cluster 
• Faster 
failure 
recovery 
• Dynamic 
cluster 
configuraMon 
• Launching 
a 
node 
in 
a 
container 
cloud. 
(Future 
maybe?)
Scenario: 
Simplify 
con>ig 
• ENV 
(from 
hostname 
or 
specified 
in 
Salt) 
• $TYPE=“prod” 
• $GROUP=“gg” 
• $DATACENTER=“mydc1” 
• Config 
could 
be 
• HOST_POSTFIX 
= 
$GROUP+$TYPE+$DATACENTER 
= 
• “prod.gg.mydc1.consul” 
• Config 
in 
Group 
• “db.prod.gg.mydc.consul” 
• Config 
for 
a 
datacenter 
• “redis.prod.mydc1.consul” 
• So, 
every 
config 
for 
prod/stg/dev 
could 
be 
the 
same. 
• Do 
config 
in 
service 
provider 
instead 
of 
every 
client. 
• Service 
provider 
could 
automaMcally 
register 
if 
supported.
Scenario: 
Dynamic 
server 
cluster 
• Background 
• A 
server 
cluster 
without 
load 
balancer 
(Cannot 
apply 
LB) 
• An 
applicaMon 
that 
use 
this 
service 
• Sequence 
• Query 
Consul 
will 
return 
a 
list 
of 
servers. 
• When 
a 
server 
failed, 
Consul 
will 
aware 
that 
very 
quickly 
and 
remove 
it 
from 
the 
list. 
• An 
applicaMon 
that 
use 
this 
cluster 
will 
be 
interrupted 
and 
need 
to 
re-­‐query 
Consul. 
Consul 
will 
return 
the 
new 
list 
of 
servers.
Scenario: 
Faster 
failure 
recovery 
• Background 
• A 
master/slave 
DB 
without 
automaMc 
failover 
• Sequence 
• The 
master 
DB 
is 
dead. 
• Nagios 
found 
it. 
• OPS 
aware 
it 
and 
log-­‐in 
slave 
DB. 
• OPS 
restart 
slave 
DB 
as 
master 
and 
run 
script 
to 
register 
new 
DB 
• All 
applicaMons 
that 
use 
this 
DB 
will 
change 
to 
new 
DB.
Scenario: 
Dynamic 
cluster 
con>iguration 
• If 
a 
service 
cluster 
needs 
dynamic/automaMc 
change 
configuraMon 
during 
run-­‐Mme.
Scenario: 
Launching 
a 
node 
in 
a 
container 
cloud. 
• Assume 
the 
container 
image 
of 
the 
service 
is 
ready. 
• Specify 
correct 
hostname 
of 
the 
new 
container. 
• Launch 
the 
new 
container. 
• The 
new 
container 
start 
the 
new 
service. 
• If 
it 
is 
a 
simple 
service 
provider, 
it 
registers 
itself 
to 
Consul. 
• If 
it 
uses 
other 
services, 
it 
queries 
these 
services 
from 
Consul. 
• If 
the 
configuraMon 
is 
all 
the 
same, 
the 
new 
node 
is 
ready.
OTHERS
Use 
pip 
+ 
virtualenv 
• Why, 
• Reduce 
package 
conflict. 
(Use 
egg 
is 
not 
very 
friendly.) 
• Some 
Python 
packages 
doesn’t 
have 
RPM. 
• Install 
using 
requirement.txt 
(pip 
install 
–r 
requirement.txt) 
• (?) 
private 
pip 
repository 
• Below 
for 
dev 
• Use 
virtualenvwrapper 
to 
be 
more 
convenient. 
• How 
to 
produce 
requirement 
more 
easily? 
• pip 
freeze 
> 
stable-­‐req.txt 
• Pip 
freeze 
–r 
dev-­‐req.txt 
> 
stable-­‐req.txt 
# 
Keep 
old 
comments
Example: 
requirement.txt 
• Beaker==1.3.1 
• Chameleon==2.11 
• DecoratorTools==1.7 
• DistuMls2==1.0a3 
• Django==1.5.1 
• M2Crypto==0.20.2 
• Magic-­‐file-­‐extensions==0.1 
• Mako==0.8.1 
• MarkupSafe==0.9.2 
• MySQL-­‐python==1.2.3c1 
• PasteDeploy==1.5.0 
• PyXML==0.8.4 
• Pygments==1.1.1 
• SOAPpy==0.11.6 
• SSSDConfig==1.11.6 
• Scrapy==0.18.4
Store 
SHOULD-­‐BE-­‐CHANGED 
con>ig 
in 
environment 
var 
• Why, 
• Leak 
secrets 
in 
version 
control 
system. 
• Check-­‐in 
always 
config 
to 
version 
control 
system 
accidentally. 
• Example, 
• DB 
username/password, 
AWS 
API 
Keys 
• Secret-­‐token 
(web 
framework 
like 
Django) 
• URI 
resource 
string, 
Used 
service 
host, 
port 
…..
Explicitly 
store 
prod/stg/dev 
settings 
in 
version 
control 
• Why, 
• Check-­‐in 
always 
config 
to 
version 
control 
system 
accidentally. 
• All 
sevngs 
in 
all 
environment 
are 
visible 
to 
everyone. 
• For 
example, 
• DEBUG=True 
in 
Django 
• Log 
level 
• How 
(Django 
for 
example) 
• sevngs/ 
• prod.py 
• staging.py 
• dev.py 
• ENV[“DJANGO_SETTINGS_MODULE”] 
= 
“sevngs.prod” 
• “sevngs.prod” 
could 
automaMcally 
come 
from 
hostname. 
• If 
this 
env 
variable 
is 
not 
set, 
service 
will 
print 
log 
and 
exit.
Consul 
vs. 
SkyDNS 
• Pros 
• Beyer 
health 
check 
(SkyDNS 
uses 
heartbeat 
+ 
TTL) 
• MulMple 
datacenter 
support 
by 
using 
“region”. 
• A 
beyer 
web 
view. 
(hyp://demo.consul.io/ui/) 
• Beyer 
RAFT 
implementaMon 
(unverified) 
• Cons 
• lesser 
contributors 
(1/3) 
• More 
immature 
(0.41 
now) 
and 
young.
Problem 
needs 
attention 
• For 
only 
one 
server 
service 
like 
DB, 
what 
if 
a 
second 
server 
register 
the 
service 
accidentally? 
• Use 
DNS+DNS 
forwarding 
approach 
may 
not 
be 
good 
for 
DNS 
heavy 
service. 
(Like 
Odin)
Other 
References 
• Service 
registrator 
for 
Docker 
• hyps://github.com/progrium/registrator 
• Set 
env 
by 
Consul 
• hyps://github.com/hashicorp/envconsul

More Related Content

What's hot

The Good Parts / The Hard Parts
The Good Parts / The Hard PartsThe Good Parts / The Hard Parts
The Good Parts / The Hard Parts
Noah Zoschke
 
Kubernetes 1.3 - Highlights
Kubernetes 1.3 - HighlightsKubernetes 1.3 - Highlights
Kubernetes 1.3 - Highlights
Matthew Barker
 
Host Health Monitoring with Docker Run
Host Health Monitoring with Docker RunHost Health Monitoring with Docker Run
Host Health Monitoring with Docker Run
Noah Zoschke
 
Load Balancing Apps in Docker Swarm with NGINX
Load Balancing Apps in Docker Swarm with NGINXLoad Balancing Apps in Docker Swarm with NGINX
Load Balancing Apps in Docker Swarm with NGINX
NGINX, Inc.
 
Dockercon Swarm Updated
Dockercon Swarm UpdatedDockercon Swarm Updated
Dockercon Swarm Updated
Docker, Inc.
 
Amazon EC2 Container Service in Action
Amazon EC2 Container Service in ActionAmazon EC2 Container Service in Action
Amazon EC2 Container Service in Action
Remotty
 
Scaling Development Environments with Docker
Scaling Development Environments with DockerScaling Development Environments with Docker
Scaling Development Environments with Docker
Docker, Inc.
 
Docker Swarm for Beginner
Docker Swarm for BeginnerDocker Swarm for Beginner
Docker Swarm for Beginner
Shahzad Masud
 
Docker Swarm Introduction
Docker Swarm IntroductionDocker Swarm Introduction
Docker Swarm Introduction
rajdeep
 
Testing your infrastructure with litmus
Testing your infrastructure with litmusTesting your infrastructure with litmus
Testing your infrastructure with litmus
Bram Vogelaar
 
[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법
Open Source Consulting
 
Installation Openstack Swift
Installation Openstack SwiftInstallation Openstack Swift
Installation Openstack Swift
ymtech
 
I can't believe it's not a queue: Kafka and Spring
I can't believe it's not a queue: Kafka and SpringI can't believe it's not a queue: Kafka and Spring
I can't believe it's not a queue: Kafka and Spring
Joe Kutner
 
Docker 1.5
Docker 1.5Docker 1.5
Docker 1.5
rajdeep
 
An intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECSAn intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECS
Yevgeniy Brikman
 
Swarm mode
Swarm modeSwarm mode
Swarm mode
Dharmit Shah
 
Setup 3 Node Kafka Cluster on AWS - Hands On
Setup 3 Node Kafka Cluster on AWS - Hands OnSetup 3 Node Kafka Cluster on AWS - Hands On
Setup 3 Node Kafka Cluster on AWS - Hands On
hkbhadraa
 
Lesson Learned from Using Docker Swarm at Pronto
Lesson Learned from Using Docker Swarm at ProntoLesson Learned from Using Docker Swarm at Pronto
Lesson Learned from Using Docker Swarm at Pronto
Kan Ouivirach, Ph.D.
 
Docker and Maestro for fun, development and profit
Docker and Maestro for fun, development and profitDocker and Maestro for fun, development and profit
Docker and Maestro for fun, development and profit
Maxime Petazzoni
 

What's hot (20)

The Good Parts / The Hard Parts
The Good Parts / The Hard PartsThe Good Parts / The Hard Parts
The Good Parts / The Hard Parts
 
Kubernetes 1.3 - Highlights
Kubernetes 1.3 - HighlightsKubernetes 1.3 - Highlights
Kubernetes 1.3 - Highlights
 
Host Health Monitoring with Docker Run
Host Health Monitoring with Docker RunHost Health Monitoring with Docker Run
Host Health Monitoring with Docker Run
 
Load Balancing Apps in Docker Swarm with NGINX
Load Balancing Apps in Docker Swarm with NGINXLoad Balancing Apps in Docker Swarm with NGINX
Load Balancing Apps in Docker Swarm with NGINX
 
Dockercon Swarm Updated
Dockercon Swarm UpdatedDockercon Swarm Updated
Dockercon Swarm Updated
 
Amazon EC2 Container Service in Action
Amazon EC2 Container Service in ActionAmazon EC2 Container Service in Action
Amazon EC2 Container Service in Action
 
Scaling Development Environments with Docker
Scaling Development Environments with DockerScaling Development Environments with Docker
Scaling Development Environments with Docker
 
Docker Swarm for Beginner
Docker Swarm for BeginnerDocker Swarm for Beginner
Docker Swarm for Beginner
 
Docker Swarm Introduction
Docker Swarm IntroductionDocker Swarm Introduction
Docker Swarm Introduction
 
Testing your infrastructure with litmus
Testing your infrastructure with litmusTesting your infrastructure with litmus
Testing your infrastructure with litmus
 
[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법
 
Installation Openstack Swift
Installation Openstack SwiftInstallation Openstack Swift
Installation Openstack Swift
 
I can't believe it's not a queue: Kafka and Spring
I can't believe it's not a queue: Kafka and SpringI can't believe it's not a queue: Kafka and Spring
I can't believe it's not a queue: Kafka and Spring
 
Docker 1.5
Docker 1.5Docker 1.5
Docker 1.5
 
An intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECSAn intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECS
 
Swarm mode
Swarm modeSwarm mode
Swarm mode
 
Setup 3 Node Kafka Cluster on AWS - Hands On
Setup 3 Node Kafka Cluster on AWS - Hands OnSetup 3 Node Kafka Cluster on AWS - Hands On
Setup 3 Node Kafka Cluster on AWS - Hands On
 
Lesson Learned from Using Docker Swarm at Pronto
Lesson Learned from Using Docker Swarm at ProntoLesson Learned from Using Docker Swarm at Pronto
Lesson Learned from Using Docker Swarm at Pronto
 
Docker and Maestro for fun, development and profit
Docker and Maestro for fun, development and profitDocker and Maestro for fun, development and profit
Docker and Maestro for fun, development and profit
 
About Node.js
About Node.jsAbout Node.js
About Node.js
 

Similar to Consul - service discovery and others

Kubernetes Walk Through from Technical View
Kubernetes Walk Through from Technical ViewKubernetes Walk Through from Technical View
Kubernetes Walk Through from Technical View
Lei (Harry) Zhang
 
Ansible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less CoffeeAnsible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less Coffee
Sarah Z
 
NSBCon UK nservicebus on Azure by Yves Goeleven
NSBCon UK nservicebus on Azure by Yves GoelevenNSBCon UK nservicebus on Azure by Yves Goeleven
NSBCon UK nservicebus on Azure by Yves Goeleven
Particular Software
 
NetflixOSS Open House Lightning talks
NetflixOSS Open House Lightning talksNetflixOSS Open House Lightning talks
NetflixOSS Open House Lightning talks
Ruslan Meshenberg
 
Distributed system coordination by zookeeper and introduction to kazoo python...
Distributed system coordination by zookeeper and introduction to kazoo python...Distributed system coordination by zookeeper and introduction to kazoo python...
Distributed system coordination by zookeeper and introduction to kazoo python...
Jimmy Lai
 
Where Django Caching Bust at the Seams
Where Django Caching Bust at the SeamsWhere Django Caching Bust at the Seams
Where Django Caching Bust at the Seams
Concentric Sky
 
Benchmarking Solr Performance at Scale
Benchmarking Solr Performance at ScaleBenchmarking Solr Performance at Scale
Benchmarking Solr Performance at Scale
thelabdude
 
To Build My Own Cloud with Blackjack…
To Build My Own Cloud with Blackjack…To Build My Own Cloud with Blackjack…
To Build My Own Cloud with Blackjack…
Sergey Dzyuban
 
[AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵
 [AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵 [AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵
[AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵
Amazon Web Services Korea
 
More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)
Michael Collier
 
Galera cluster for high availability
Galera cluster for high availability Galera cluster for high availability
Galera cluster for high availability
Mydbops
 
DjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling DisqusDjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling Disqus
zeeg
 
Autoscaled Distributed Automation Expedia Know How
Autoscaled Distributed Automation Expedia Know HowAutoscaled Distributed Automation Expedia Know How
Autoscaled Distributed Automation Expedia Know How
aragavan
 
Planning to Fail #phpne13
Planning to Fail #phpne13Planning to Fail #phpne13
Planning to Fail #phpne13
Dave Gardner
 
Managing and Scaling Puppet - PuppetConf 2014
Managing and Scaling Puppet - PuppetConf 2014Managing and Scaling Puppet - PuppetConf 2014
Managing and Scaling Puppet - PuppetConf 2014
Miguel Zuniga
 
Cloud computing & lamp applications
Cloud computing & lamp applicationsCloud computing & lamp applications
Cloud computing & lamp applications
Corley S.r.l.
 
Containers orchestrators: Docker vs. Kubernetes
Containers orchestrators: Docker vs. KubernetesContainers orchestrators: Docker vs. Kubernetes
Containers orchestrators: Docker vs. Kubernetes
Dmitry Lazarenko
 
Cassandra
CassandraCassandra
Cassandraexsuns
 
Riak add presentation
Riak add presentationRiak add presentation
Riak add presentation
Ilya Bogunov
 
Apache Performance Tuning: Scaling Out
Apache Performance Tuning: Scaling OutApache Performance Tuning: Scaling Out
Apache Performance Tuning: Scaling Out
Sander Temme
 

Similar to Consul - service discovery and others (20)

Kubernetes Walk Through from Technical View
Kubernetes Walk Through from Technical ViewKubernetes Walk Through from Technical View
Kubernetes Walk Through from Technical View
 
Ansible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less CoffeeAnsible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less Coffee
 
NSBCon UK nservicebus on Azure by Yves Goeleven
NSBCon UK nservicebus on Azure by Yves GoelevenNSBCon UK nservicebus on Azure by Yves Goeleven
NSBCon UK nservicebus on Azure by Yves Goeleven
 
NetflixOSS Open House Lightning talks
NetflixOSS Open House Lightning talksNetflixOSS Open House Lightning talks
NetflixOSS Open House Lightning talks
 
Distributed system coordination by zookeeper and introduction to kazoo python...
Distributed system coordination by zookeeper and introduction to kazoo python...Distributed system coordination by zookeeper and introduction to kazoo python...
Distributed system coordination by zookeeper and introduction to kazoo python...
 
Where Django Caching Bust at the Seams
Where Django Caching Bust at the SeamsWhere Django Caching Bust at the Seams
Where Django Caching Bust at the Seams
 
Benchmarking Solr Performance at Scale
Benchmarking Solr Performance at ScaleBenchmarking Solr Performance at Scale
Benchmarking Solr Performance at Scale
 
To Build My Own Cloud with Blackjack…
To Build My Own Cloud with Blackjack…To Build My Own Cloud with Blackjack…
To Build My Own Cloud with Blackjack…
 
[AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵
 [AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵 [AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵
[AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵
 
More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)
 
Galera cluster for high availability
Galera cluster for high availability Galera cluster for high availability
Galera cluster for high availability
 
DjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling DisqusDjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling Disqus
 
Autoscaled Distributed Automation Expedia Know How
Autoscaled Distributed Automation Expedia Know HowAutoscaled Distributed Automation Expedia Know How
Autoscaled Distributed Automation Expedia Know How
 
Planning to Fail #phpne13
Planning to Fail #phpne13Planning to Fail #phpne13
Planning to Fail #phpne13
 
Managing and Scaling Puppet - PuppetConf 2014
Managing and Scaling Puppet - PuppetConf 2014Managing and Scaling Puppet - PuppetConf 2014
Managing and Scaling Puppet - PuppetConf 2014
 
Cloud computing & lamp applications
Cloud computing & lamp applicationsCloud computing & lamp applications
Cloud computing & lamp applications
 
Containers orchestrators: Docker vs. Kubernetes
Containers orchestrators: Docker vs. KubernetesContainers orchestrators: Docker vs. Kubernetes
Containers orchestrators: Docker vs. Kubernetes
 
Cassandra
CassandraCassandra
Cassandra
 
Riak add presentation
Riak add presentationRiak add presentation
Riak add presentation
 
Apache Performance Tuning: Scaling Out
Apache Performance Tuning: Scaling OutApache Performance Tuning: Scaling Out
Apache Performance Tuning: Scaling Out
 

More from Walter Liu

Generative AI 在手機遊戲發行上的應用介紹.pdf
Generative AI 在手機遊戲發行上的應用介紹.pdfGenerative AI 在手機遊戲發行上的應用介紹.pdf
Generative AI 在手機遊戲發行上的應用介紹.pdf
Walter Liu
 
Infrastructure as code using Kubernetes
Infrastructure as code using KubernetesInfrastructure as code using Kubernetes
Infrastructure as code using Kubernetes
Walter Liu
 
手機遊戲數位行銷工具淺談
手機遊戲數位行銷工具淺談手機遊戲數位行銷工具淺談
手機遊戲數位行銷工具淺談
Walter Liu
 
關於第三方追蹤廣告再行銷的那些事兒
關於第三方追蹤廣告再行銷的那些事兒關於第三方追蹤廣告再行銷的那些事兒
關於第三方追蹤廣告再行銷的那些事兒
Walter Liu
 
Kubernetes Workshop
Kubernetes WorkshopKubernetes Workshop
Kubernetes Workshop
Walter Liu
 
Using Kubernetes to deploy Django in GCP
Using Kubernetes to deploy Django in GCPUsing Kubernetes to deploy Django in GCP
Using Kubernetes to deploy Django in GCP
Walter Liu
 
Game DDOS Prevention
Game DDOS PreventionGame DDOS Prevention
Game DDOS Prevention
Walter Liu
 
Airflow - a data flow engine
Airflow - a data flow engineAirflow - a data flow engine
Airflow - a data flow engine
Walter Liu
 
Super Fast Gevent Introduction
Super Fast Gevent IntroductionSuper Fast Gevent Introduction
Super Fast Gevent Introduction
Walter Liu
 
HTTP/2 to web dev
HTTP/2 to web devHTTP/2 to web dev
HTTP/2 to web dev
Walter Liu
 
HTTP/2 Introduction
HTTP/2 IntroductionHTTP/2 Introduction
HTTP/2 Introduction
Walter Liu
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
Walter Liu
 
WRS GIT Branching Model - draft
WRS GIT Branching Model - draftWRS GIT Branching Model - draft
WRS GIT Branching Model - draft
Walter Liu
 
Salty OPS – Saltstack Introduction
Salty OPS – Saltstack IntroductionSalty OPS – Saltstack Introduction
Salty OPS – Saltstack IntroductionWalter Liu
 
Django deployment and rpm+yum
Django deployment and rpm+yumDjango deployment and rpm+yum
Django deployment and rpm+yumWalter Liu
 
Game Localization in Python
Game Localization in PythonGame Localization in Python
Game Localization in Python
Walter Liu
 
Service production from d3 pitfall viewpoint
Service production from d3 pitfall viewpointService production from d3 pitfall viewpoint
Service production from d3 pitfall viewpointWalter Liu
 
Celery in the Django
Celery in the DjangoCelery in the Django
Celery in the Django
Walter Liu
 

More from Walter Liu (18)

Generative AI 在手機遊戲發行上的應用介紹.pdf
Generative AI 在手機遊戲發行上的應用介紹.pdfGenerative AI 在手機遊戲發行上的應用介紹.pdf
Generative AI 在手機遊戲發行上的應用介紹.pdf
 
Infrastructure as code using Kubernetes
Infrastructure as code using KubernetesInfrastructure as code using Kubernetes
Infrastructure as code using Kubernetes
 
手機遊戲數位行銷工具淺談
手機遊戲數位行銷工具淺談手機遊戲數位行銷工具淺談
手機遊戲數位行銷工具淺談
 
關於第三方追蹤廣告再行銷的那些事兒
關於第三方追蹤廣告再行銷的那些事兒關於第三方追蹤廣告再行銷的那些事兒
關於第三方追蹤廣告再行銷的那些事兒
 
Kubernetes Workshop
Kubernetes WorkshopKubernetes Workshop
Kubernetes Workshop
 
Using Kubernetes to deploy Django in GCP
Using Kubernetes to deploy Django in GCPUsing Kubernetes to deploy Django in GCP
Using Kubernetes to deploy Django in GCP
 
Game DDOS Prevention
Game DDOS PreventionGame DDOS Prevention
Game DDOS Prevention
 
Airflow - a data flow engine
Airflow - a data flow engineAirflow - a data flow engine
Airflow - a data flow engine
 
Super Fast Gevent Introduction
Super Fast Gevent IntroductionSuper Fast Gevent Introduction
Super Fast Gevent Introduction
 
HTTP/2 to web dev
HTTP/2 to web devHTTP/2 to web dev
HTTP/2 to web dev
 
HTTP/2 Introduction
HTTP/2 IntroductionHTTP/2 Introduction
HTTP/2 Introduction
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
WRS GIT Branching Model - draft
WRS GIT Branching Model - draftWRS GIT Branching Model - draft
WRS GIT Branching Model - draft
 
Salty OPS – Saltstack Introduction
Salty OPS – Saltstack IntroductionSalty OPS – Saltstack Introduction
Salty OPS – Saltstack Introduction
 
Django deployment and rpm+yum
Django deployment and rpm+yumDjango deployment and rpm+yum
Django deployment and rpm+yum
 
Game Localization in Python
Game Localization in PythonGame Localization in Python
Game Localization in Python
 
Service production from d3 pitfall viewpoint
Service production from d3 pitfall viewpointService production from d3 pitfall viewpoint
Service production from d3 pitfall viewpoint
 
Celery in the Django
Celery in the DjangoCelery in the Django
Celery in the Django
 

Recently uploaded

Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
ViralQR
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 

Recently uploaded (20)

Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 

Consul - service discovery and others

  • 1. Consul -­‐ Service discovery and others By Walter Liu 2014/11/11
  • 2. Similar services • Consul • SkyDNS • Others • Zookeeper • etcd • Serf
  • 3. What’s Consul? • Service Discovery • DNS • HTTP (JSON) • Health Checking (Service Discovery need this) • Key/Value Store • dynamic configuraMon • feature flagging • coordinaMon • leader elecMon • (Very like the funcMonality of Zookeeper we used) • MulM Datacenter • Network parMMon • If one DC off, no impact to another DC. • Data duplicate to another DC automaMcally.
  • 4.
  • 5. User Scenarios in Our Infra • Simplify config (even with SaltStack) • Dynamic server cluster • Faster failure recovery • Dynamic cluster configuraMon • Launching a node in a container cloud. (Future maybe?)
  • 6. Scenario: Simplify con>ig • ENV (from hostname or specified in Salt) • $TYPE=“prod” • $GROUP=“gg” • $DATACENTER=“mydc1” • Config could be • HOST_POSTFIX = $GROUP+$TYPE+$DATACENTER = • “prod.gg.mydc1.consul” • Config in Group • “db.prod.gg.mydc.consul” • Config for a datacenter • “redis.prod.mydc1.consul” • So, every config for prod/stg/dev could be the same. • Do config in service provider instead of every client. • Service provider could automaMcally register if supported.
  • 7. Scenario: Dynamic server cluster • Background • A server cluster without load balancer (Cannot apply LB) • An applicaMon that use this service • Sequence • Query Consul will return a list of servers. • When a server failed, Consul will aware that very quickly and remove it from the list. • An applicaMon that use this cluster will be interrupted and need to re-­‐query Consul. Consul will return the new list of servers.
  • 8. Scenario: Faster failure recovery • Background • A master/slave DB without automaMc failover • Sequence • The master DB is dead. • Nagios found it. • OPS aware it and log-­‐in slave DB. • OPS restart slave DB as master and run script to register new DB • All applicaMons that use this DB will change to new DB.
  • 9. Scenario: Dynamic cluster con>iguration • If a service cluster needs dynamic/automaMc change configuraMon during run-­‐Mme.
  • 10. Scenario: Launching a node in a container cloud. • Assume the container image of the service is ready. • Specify correct hostname of the new container. • Launch the new container. • The new container start the new service. • If it is a simple service provider, it registers itself to Consul. • If it uses other services, it queries these services from Consul. • If the configuraMon is all the same, the new node is ready.
  • 12. Use pip + virtualenv • Why, • Reduce package conflict. (Use egg is not very friendly.) • Some Python packages doesn’t have RPM. • Install using requirement.txt (pip install –r requirement.txt) • (?) private pip repository • Below for dev • Use virtualenvwrapper to be more convenient. • How to produce requirement more easily? • pip freeze > stable-­‐req.txt • Pip freeze –r dev-­‐req.txt > stable-­‐req.txt # Keep old comments
  • 13. Example: requirement.txt • Beaker==1.3.1 • Chameleon==2.11 • DecoratorTools==1.7 • DistuMls2==1.0a3 • Django==1.5.1 • M2Crypto==0.20.2 • Magic-­‐file-­‐extensions==0.1 • Mako==0.8.1 • MarkupSafe==0.9.2 • MySQL-­‐python==1.2.3c1 • PasteDeploy==1.5.0 • PyXML==0.8.4 • Pygments==1.1.1 • SOAPpy==0.11.6 • SSSDConfig==1.11.6 • Scrapy==0.18.4
  • 14. Store SHOULD-­‐BE-­‐CHANGED con>ig in environment var • Why, • Leak secrets in version control system. • Check-­‐in always config to version control system accidentally. • Example, • DB username/password, AWS API Keys • Secret-­‐token (web framework like Django) • URI resource string, Used service host, port …..
  • 15. Explicitly store prod/stg/dev settings in version control • Why, • Check-­‐in always config to version control system accidentally. • All sevngs in all environment are visible to everyone. • For example, • DEBUG=True in Django • Log level • How (Django for example) • sevngs/ • prod.py • staging.py • dev.py • ENV[“DJANGO_SETTINGS_MODULE”] = “sevngs.prod” • “sevngs.prod” could automaMcally come from hostname. • If this env variable is not set, service will print log and exit.
  • 16. Consul vs. SkyDNS • Pros • Beyer health check (SkyDNS uses heartbeat + TTL) • MulMple datacenter support by using “region”. • A beyer web view. (hyp://demo.consul.io/ui/) • Beyer RAFT implementaMon (unverified) • Cons • lesser contributors (1/3) • More immature (0.41 now) and young.
  • 17. Problem needs attention • For only one server service like DB, what if a second server register the service accidentally? • Use DNS+DNS forwarding approach may not be good for DNS heavy service. (Like Odin)
  • 18. Other References • Service registrator for Docker • hyps://github.com/progrium/registrator • Set env by Consul • hyps://github.com/hashicorp/envconsul