SlideShare una empresa de Scribd logo
1 de 29
Descargar para leer sin conexión
www.eleven-labs.com
WORKSHOP
Factory
Vincent Composieux
@vcomposieux
… to beyond and
CONSULSERVICE DISCOVERY
&
FAILURE DETECTION
2013
FIRST COMMIT
WHAT ABOUT CONSUL?
Open-source & built by HashiCorp.
“Consul has multiple components,
but as a whole, it is a tool for
discovering and configuring
services in your infrastructure.”
GO
WRITTEN
WHAT ABOUT CONSUL?
FRONT 01 FRONT 02 FRONT 03
Terminal
$ curl http://frontend.eleven-labs.com ..
DNS API
UP UPDOWN
WHAT ABOUT CONSUL?
SERVICE DISCOVERY
➔ Register new services via configuration or API
➔ Access all available services or a specific one
➔ Updates automatically when new services are
available or not
FAILURE DETECTION
➔ Updates automatically Consul services when
a service is down
➔ Manages services states (we can put a
service in maintenance for instance)
CONSENSUS
PROTOCOL
http://thesecretlivesofdata.com/raft/
WHAT ABOUT CONSUL?
GOSSIP
PROTOCOL
This is for consistency:
nodes inherit from a state:
follower, candidate or
leader.
Propagation of information (epidemy)
WHAT ABOUT CONSUL?
8600
DNS
8500
HTTP
8300
8400
RPC
Use port 8300 (TCP only) but also:
➔ 8301 (TCP/UDP, Gossip over LAN)
➔ 8302 (TCP/UDP, Gossip over WAN)
This port exposes:
➔ A web UI
➔ A HTTP API
This port is used for DNS server.
Possible to override with --dns-port
WHAT ABOUT CONSUL?
https://demo.consul.io
WEB UI LOOKS LIKE THIS
SERVICE DISCOVERY
HANDS ON
swarm
→ registrator
→ ekofr/http-ip
swarm
→ registrator
→ ekofr/http-ip
ARCHITECTURE
CONSUL
(Machine / Swarm Discovery)
NODE #01
(Machine / Master)
NODE #02
(Machine)
HTTP DNS
1
2 33
DOCKER
MACHINES
1
SWARM
CLUSTER
7
DOCKER
CONTAINERS
CONSUL > Machine
Terminal
$ docker-machine create -d virtualbox consul ..
Create the “consul-master” machine under Docker,
using the Virtualbox driver.
CONSUL
(Machine)
CONSUL > Container
Terminal
$ eval $(docker-machine env consul)
$ docker run -d 
-p 8301:8301 
-p 8302:8302 
-p 8400:8400 
-p 8500:8500 
-p 53:8600/udp consul ..
Enter your consul-master environment and run the
“consul” Docker image (as server).
CONSUL
(Machine)
NODE #01 > Machine (New tab)
Terminal
$ docker-machine create -d virtualbox 
--swarm 
--swarm-master 
--swarm-discovery="consul://$(docker-machine ip consul):8500" 
--engine-opt="cluster-store=consul://$(docker-machine ip
consul):8500" 
--engine-opt="cluster-advertise=eth1:2376" swarm-node-01 ..
Create the “swarm-node-01” machine under Docker
and map Swarm discovery with Consul.
CONSUL
(Machine)
NODE #01
NODE #01 > Registrator
Terminal
$ eval $(docker-machine env swarm-node-01)
$ docker run -d 
--volume=/var/run/docker.sock:/tmp/docker.sock 
gliderlabs/registrator 
-ip $(docker-machine ip swarm-node-01) 
consul://$(docker-machine ip consul):8500 ..
Enter “swarm-node-01” machine and run a
Registrator Docker image as a daemon.
CONSUL
(Machine)
NODE #01
NODE #01 > HTTP Container
Terminal
$ docker network create 
--subnet=172.18.0.0/16 network-node-01
$ docker run -d 
--net network-node-01 
-p 80:8080 
ekofr/http-ip ..
Create a “network-node-01” Docker network and run
“ekofr/http-ip” using this network.
CONSUL
(Machine)
NODE #01
NODE #02 > Machine (New tab)
Terminal
$ docker-machine create -d virtualbox 
--swarm 
--swarm-discovery="consul://$(docker-machine ip consul):8500" 
--engine-opt="cluster-store=consul://$(docker-machine ip
consul):8500" 
--engine-opt="cluster-advertise=eth1:2376" swarm-node-02 ..
Create the “swarm-node-02” machine under Docker
and map Swarm discovery with Consul.
CONSUL
(Machine)
NODE #01 NODE #02
NODE #02 > Registrator
Terminal
$ eval $(docker-machine env swarm-node-02)
$ docker run -d 
--volume=/var/run/docker.sock:/tmp/docker.sock 
gliderlabs/registrator 
-ip $(docker-machine ip swarm-node-02) 
consul://$(docker-machine ip consul):8500 ..
Enter “swarm-node-02” machine and run a
Registrator Docker image as a daemon.
CONSUL
(Machine)
NODE #01 NODE #02
NODE #02 > HTTP Container
Terminal
$ docker network create 
--subnet=172.19.0.0/16 network-node-02
$ docker run -d 
--net network-node-02 
-p 80:8080 
ekofr/http-ip ..
Create a “network-node-02” Docker network and run
“ekofr/http-ip” using this network.
CONSUL
(Machine)
NODE #01 NODE #02
What’s happening on DNS?
Terminal
$ dig @$(docker-machine ip consul) http-ip.service.consul ..
;; QUESTION SECTION:
;http-ip.service.consul. IN A
;; ANSWER SECTION:
http-ip.service.consul. 0 IN A 192.168.99.100
http-ip.service.consul. 0 IN A 192.168.99.102
Let’s make a DNS call to ensure that our “http-ip”
service is available under 2 machines! Shutdown them!
DNS
What’s happening on DNS?
Terminal
$ dig @$(docker-machine ip consul) http-ip.service.consul SRV ..
;; ANSWER SECTION:
http-ip.service.consul. 0 IN SRV 1 1 80 c0a86366.addr.dc1.consul.
http-ip.service.consul. 0 IN SRV 1 1 80 c0a86364.addr.dc1.consul.
SRV records allows to define a priority and a weight for DNS
entries but it is not supported by Consul at this time.
You can find more information on SRV records on Wikipedia.
Add DNS to your system
Let’s make an HTTP call to ensure that both nodes
answers. Add Consul DNS server as a resolver.
CONSUL
(Machine)
Call HTTP service
Terminal
$ curl http://http-ip.service.consul
hello from 172.18.0.2
$ curl http://http-ip.service.consul ..
hello from 172.19.0.2
Now, perform your HTTP request and confirm that you are
balanced between your two machines.
HTTP DNS
FAILURE DETECTION
HANDS ON
NODE #01 > Add a HTTP check
Terminal
$ eval $(docker-machine env swarm-node-01)
$ docker kill 
$(docker ps -q --filter='ancestor=ekofr/http-ip') ..
First, kill the docker container that runs ekofr/http-ip.
We will launch it just after with a health check.
NODE #01 > Add a HTTP check
Terminal
$ docker run -d 
--net network-node-01 -p 80:8080 
-e SERVICE_CHECK_SCRIPT="curl -s -f http://$(docker-machine ip
swarm-node-01)" 
-e SERVICE_CHECK_INTERVAL=5s 
-e SERVICE_CHECK_TIMEOUT=1s 
ekofr/http-ip ..
Add a check to the ekofr/http-ip container.
We add a HTTP check here but it could be what you want.
More information about Registrator available environment variables here.
More information on Consul check definition here.
NODE #02 > Add a HTTP check
Terminal
$ eval $(docker-machine env swarm-node-02)
$ docker kill 
$(docker ps -q --filter='ancestor=ekofr/http-ip') ..
First, kill the docker container that runs ekofr/http-ip.
We will launch it just after with a health check.
NODE #02 > Add a HTTP check
Terminal
$ docker run -d 
--net network-node-02 -p 80:8080 
-e SERVICE_CHECK_SCRIPT="curl -s -f http://$(docker-machine ip
swarm-node-02)" 
-e SERVICE_CHECK_INTERVAL=5s 
-e SERVICE_CHECK_TIMEOUT=1s 
ekofr/http-ip ..
Add a check to the ekofr/http-ip container.
We add a HTTP check here but it could be what you want.
More information about Registrator available environment variables here.
More information on Consul check definition here.
Check services health via web UI
If you launch the UI, you should see your health checks:
Check services health via API
Terminal
$ curl http://$(docker-machine ip consul):8500/v1/health/checks/http-ip ..
[
{
"Status": "passing",
"Output": "hello from 172.18.0.2",
"ServiceName": "http-ip",
},
…
]
Note that you can also check your services’s health via the
Consul API “/health” endpoint:
THANK YOU

Más contenido relacionado

La actualidad más candente

Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3kognate
 
Microservices blue-green-deployment-with-docker
Microservices blue-green-deployment-with-dockerMicroservices blue-green-deployment-with-docker
Microservices blue-green-deployment-with-dockerKidong Lee
 
Solving anything in VCL
Solving anything in VCLSolving anything in VCL
Solving anything in VCLFastly
 
A complete guide to Node.js
A complete guide to Node.jsA complete guide to Node.js
A complete guide to Node.jsPrabin Silwal
 
Advanced VCL: how to use restart
Advanced VCL: how to use restartAdvanced VCL: how to use restart
Advanced VCL: how to use restartFastly
 
Getting Started with Consul
Getting Started with ConsulGetting Started with Consul
Getting Started with ConsulRamit Surana
 
Service discovery like a pro (presented at reversimX)
Service discovery like a pro (presented at reversimX)Service discovery like a pro (presented at reversimX)
Service discovery like a pro (presented at reversimX)Eran Harel
 
VCL template abstraction model and automated deployments to Fastly
VCL template abstraction model and automated deployments to FastlyVCL template abstraction model and automated deployments to Fastly
VCL template abstraction model and automated deployments to FastlyFastly
 
Altitude SF 2017: Debugging Fastly VCL 101
Altitude SF 2017: Debugging Fastly VCL 101Altitude SF 2017: Debugging Fastly VCL 101
Altitude SF 2017: Debugging Fastly VCL 101Fastly
 
openstack源码分析(1)
openstack源码分析(1)openstack源码分析(1)
openstack源码分析(1)cannium
 
Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Orchestration? You Don't Need Orchestration. What You Want is Choreography.Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Orchestration? You Don't Need Orchestration. What You Want is Choreography.Julian Dunn
 
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 ECSYevgeniy Brikman
 
Puppet in the Pipeline
Puppet in the PipelinePuppet in the Pipeline
Puppet in the PipelinePuppet
 
OpenNebula and SaltStack - OpenNebulaConf 2013
OpenNebula and SaltStack - OpenNebulaConf 2013OpenNebula and SaltStack - OpenNebulaConf 2013
OpenNebula and SaltStack - OpenNebulaConf 2013databus.pro
 
Autoscaling with hashi_corp_nomad
Autoscaling with hashi_corp_nomadAutoscaling with hashi_corp_nomad
Autoscaling with hashi_corp_nomadBram Vogelaar
 
Deployment with capistrano
Deployment with capistranoDeployment with capistrano
Deployment with capistranosagar junnarkar
 
Altitude NY 2018: Programming the edge workshop
Altitude NY 2018: Programming the edge workshopAltitude NY 2018: Programming the edge workshop
Altitude NY 2018: Programming the edge workshopFastly
 
Beyond Breakpoints: A Tour of Dynamic Analysis
Beyond Breakpoints: A Tour of Dynamic AnalysisBeyond Breakpoints: A Tour of Dynamic Analysis
Beyond Breakpoints: A Tour of Dynamic AnalysisFastly
 
A user's perspective on SaltStack and other configuration management tools
A user's perspective on SaltStack and other configuration management toolsA user's perspective on SaltStack and other configuration management tools
A user's perspective on SaltStack and other configuration management toolsSaltStack
 

La actualidad más candente (20)

Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3
 
Microservices blue-green-deployment-with-docker
Microservices blue-green-deployment-with-dockerMicroservices blue-green-deployment-with-docker
Microservices blue-green-deployment-with-docker
 
Solving anything in VCL
Solving anything in VCLSolving anything in VCL
Solving anything in VCL
 
A complete guide to Node.js
A complete guide to Node.jsA complete guide to Node.js
A complete guide to Node.js
 
Advanced VCL: how to use restart
Advanced VCL: how to use restartAdvanced VCL: how to use restart
Advanced VCL: how to use restart
 
Getting Started with Consul
Getting Started with ConsulGetting Started with Consul
Getting Started with Consul
 
Service discovery like a pro (presented at reversimX)
Service discovery like a pro (presented at reversimX)Service discovery like a pro (presented at reversimX)
Service discovery like a pro (presented at reversimX)
 
VCL template abstraction model and automated deployments to Fastly
VCL template abstraction model and automated deployments to FastlyVCL template abstraction model and automated deployments to Fastly
VCL template abstraction model and automated deployments to Fastly
 
Altitude SF 2017: Debugging Fastly VCL 101
Altitude SF 2017: Debugging Fastly VCL 101Altitude SF 2017: Debugging Fastly VCL 101
Altitude SF 2017: Debugging Fastly VCL 101
 
openstack源码分析(1)
openstack源码分析(1)openstack源码分析(1)
openstack源码分析(1)
 
Test driven infrastructure
Test driven infrastructureTest driven infrastructure
Test driven infrastructure
 
Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Orchestration? You Don't Need Orchestration. What You Want is Choreography.Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Orchestration? You Don't Need Orchestration. What You Want is Choreography.
 
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
 
Puppet in the Pipeline
Puppet in the PipelinePuppet in the Pipeline
Puppet in the Pipeline
 
OpenNebula and SaltStack - OpenNebulaConf 2013
OpenNebula and SaltStack - OpenNebulaConf 2013OpenNebula and SaltStack - OpenNebulaConf 2013
OpenNebula and SaltStack - OpenNebulaConf 2013
 
Autoscaling with hashi_corp_nomad
Autoscaling with hashi_corp_nomadAutoscaling with hashi_corp_nomad
Autoscaling with hashi_corp_nomad
 
Deployment with capistrano
Deployment with capistranoDeployment with capistrano
Deployment with capistrano
 
Altitude NY 2018: Programming the edge workshop
Altitude NY 2018: Programming the edge workshopAltitude NY 2018: Programming the edge workshop
Altitude NY 2018: Programming the edge workshop
 
Beyond Breakpoints: A Tour of Dynamic Analysis
Beyond Breakpoints: A Tour of Dynamic AnalysisBeyond Breakpoints: A Tour of Dynamic Analysis
Beyond Breakpoints: A Tour of Dynamic Analysis
 
A user's perspective on SaltStack and other configuration management tools
A user's perspective on SaltStack and other configuration management toolsA user's perspective on SaltStack and other configuration management tools
A user's perspective on SaltStack and other configuration management tools
 

Similar a Workshop Consul .- Service Discovery & Failure Detection

Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slidesDocker, Inc.
 
Chris Swan ONUG Academy - Container Networks Tutorial
Chris Swan ONUG Academy - Container Networks TutorialChris Swan ONUG Academy - Container Networks Tutorial
Chris Swan ONUG Academy - Container Networks TutorialCohesive Networks
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Ben Hall
 
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz LachJDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz LachPROIDEA
 
Deploying and Scaling a Rails Application with Docker and Friends
Deploying and Scaling a Rails Application with Docker and FriendsDeploying and Scaling a Rails Application with Docker and Friends
Deploying and Scaling a Rails Application with Docker and FriendsInvisiblelines
 
Fullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-endFullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-endEzequiel Maraschio
 
Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Ben Hall
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierCarlos Sanchez
 
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境謝 宗穎
 
Integrating Consul and Puppet
Integrating Consul and PuppetIntegrating Consul and Puppet
Integrating Consul and PuppetOnyxPoint Inc
 
Integrating Consul and Puppet
Integrating Consul and PuppetIntegrating Consul and Puppet
Integrating Consul and PuppetDylan Cochran
 
Higher order infrastructure: from Docker basics to cluster management - Nicol...
Higher order infrastructure: from Docker basics to cluster management - Nicol...Higher order infrastructure: from Docker basics to cluster management - Nicol...
Higher order infrastructure: from Docker basics to cluster management - Nicol...Codemotion
 
Start tracking your ruby infrastructure
Start tracking your ruby infrastructureStart tracking your ruby infrastructure
Start tracking your ruby infrastructureSergiy Kukunin
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetAchieve Internet
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesLindsay Holmwood
 
Create and use a Dockerized Aruba Cloud server - CloudConf 2017
Create and use a Dockerized Aruba Cloud server - CloudConf 2017Create and use a Dockerized Aruba Cloud server - CloudConf 2017
Create and use a Dockerized Aruba Cloud server - CloudConf 2017Aruba S.p.A.
 
Things I've learned working with Docker Support
Things I've learned working with Docker SupportThings I've learned working with Docker Support
Things I've learned working with Docker SupportSujay Pillai
 
Framework Agnostic Discovery
Framework Agnostic DiscoveryFramework Agnostic Discovery
Framework Agnostic DiscoveryKubeAcademy
 

Similar a Workshop Consul .- Service Discovery & Failure Detection (20)

Simple docker hosting in FIWARE Lab
Simple docker hosting in FIWARE LabSimple docker hosting in FIWARE Lab
Simple docker hosting in FIWARE Lab
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
 
Chris Swan ONUG Academy - Container Networks Tutorial
Chris Swan ONUG Academy - Container Networks TutorialChris Swan ONUG Academy - Container Networks Tutorial
Chris Swan ONUG Academy - Container Networks Tutorial
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)
 
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz LachJDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
 
Deploying and Scaling a Rails Application with Docker and Friends
Deploying and Scaling a Rails Application with Docker and FriendsDeploying and Scaling a Rails Application with Docker and Friends
Deploying and Scaling a Rails Application with Docker and Friends
 
Fullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-endFullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-end
 
Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
 
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
 
Integrating Consul and Puppet
Integrating Consul and PuppetIntegrating Consul and Puppet
Integrating Consul and Puppet
 
Integrating Consul and Puppet
Integrating Consul and PuppetIntegrating Consul and Puppet
Integrating Consul and Puppet
 
Higher order infrastructure: from Docker basics to cluster management - Nicol...
Higher order infrastructure: from Docker basics to cluster management - Nicol...Higher order infrastructure: from Docker basics to cluster management - Nicol...
Higher order infrastructure: from Docker basics to cluster management - Nicol...
 
Start tracking your ruby infrastructure
Start tracking your ruby infrastructureStart tracking your ruby infrastructure
Start tracking your ruby infrastructure
 
The state of the swarm
The state of the swarmThe state of the swarm
The state of the swarm
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and Puppet
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
Create and use a Dockerized Aruba Cloud server - CloudConf 2017
Create and use a Dockerized Aruba Cloud server - CloudConf 2017Create and use a Dockerized Aruba Cloud server - CloudConf 2017
Create and use a Dockerized Aruba Cloud server - CloudConf 2017
 
Things I've learned working with Docker Support
Things I've learned working with Docker SupportThings I've learned working with Docker Support
Things I've learned working with Docker Support
 
Framework Agnostic Discovery
Framework Agnostic DiscoveryFramework Agnostic Discovery
Framework Agnostic Discovery
 

Último

'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...APNIC
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.soniya singh
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Servicegwenoracqe6
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663Call Girls Mumbai
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Servicesexy call girls service in goa
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024APNIC
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...tanu pandey
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024APNIC
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Standkumarajju5765
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceDelhi Call girls
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$kojalkojal131
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...singhpriety023
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Delhi Call girls
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...Escorts Call Girls
 

Último (20)

'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
Russian Call Girls in %(+971524965298  )#  Call Girls in DubaiRussian Call Girls in %(+971524965298  )#  Call Girls in Dubai
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
 
@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶
@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶
@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
 
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
 

Workshop Consul .- Service Discovery & Failure Detection

  • 1. www.eleven-labs.com WORKSHOP Factory Vincent Composieux @vcomposieux … to beyond and CONSULSERVICE DISCOVERY & FAILURE DETECTION
  • 2. 2013 FIRST COMMIT WHAT ABOUT CONSUL? Open-source & built by HashiCorp. “Consul has multiple components, but as a whole, it is a tool for discovering and configuring services in your infrastructure.” GO WRITTEN
  • 3. WHAT ABOUT CONSUL? FRONT 01 FRONT 02 FRONT 03 Terminal $ curl http://frontend.eleven-labs.com .. DNS API UP UPDOWN
  • 4. WHAT ABOUT CONSUL? SERVICE DISCOVERY ➔ Register new services via configuration or API ➔ Access all available services or a specific one ➔ Updates automatically when new services are available or not FAILURE DETECTION ➔ Updates automatically Consul services when a service is down ➔ Manages services states (we can put a service in maintenance for instance)
  • 5. CONSENSUS PROTOCOL http://thesecretlivesofdata.com/raft/ WHAT ABOUT CONSUL? GOSSIP PROTOCOL This is for consistency: nodes inherit from a state: follower, candidate or leader. Propagation of information (epidemy)
  • 6. WHAT ABOUT CONSUL? 8600 DNS 8500 HTTP 8300 8400 RPC Use port 8300 (TCP only) but also: ➔ 8301 (TCP/UDP, Gossip over LAN) ➔ 8302 (TCP/UDP, Gossip over WAN) This port exposes: ➔ A web UI ➔ A HTTP API This port is used for DNS server. Possible to override with --dns-port
  • 9. swarm → registrator → ekofr/http-ip swarm → registrator → ekofr/http-ip ARCHITECTURE CONSUL (Machine / Swarm Discovery) NODE #01 (Machine / Master) NODE #02 (Machine) HTTP DNS 1 2 33 DOCKER MACHINES 1 SWARM CLUSTER 7 DOCKER CONTAINERS
  • 10. CONSUL > Machine Terminal $ docker-machine create -d virtualbox consul .. Create the “consul-master” machine under Docker, using the Virtualbox driver. CONSUL (Machine)
  • 11. CONSUL > Container Terminal $ eval $(docker-machine env consul) $ docker run -d -p 8301:8301 -p 8302:8302 -p 8400:8400 -p 8500:8500 -p 53:8600/udp consul .. Enter your consul-master environment and run the “consul” Docker image (as server). CONSUL (Machine)
  • 12. NODE #01 > Machine (New tab) Terminal $ docker-machine create -d virtualbox --swarm --swarm-master --swarm-discovery="consul://$(docker-machine ip consul):8500" --engine-opt="cluster-store=consul://$(docker-machine ip consul):8500" --engine-opt="cluster-advertise=eth1:2376" swarm-node-01 .. Create the “swarm-node-01” machine under Docker and map Swarm discovery with Consul. CONSUL (Machine) NODE #01
  • 13. NODE #01 > Registrator Terminal $ eval $(docker-machine env swarm-node-01) $ docker run -d --volume=/var/run/docker.sock:/tmp/docker.sock gliderlabs/registrator -ip $(docker-machine ip swarm-node-01) consul://$(docker-machine ip consul):8500 .. Enter “swarm-node-01” machine and run a Registrator Docker image as a daemon. CONSUL (Machine) NODE #01
  • 14. NODE #01 > HTTP Container Terminal $ docker network create --subnet=172.18.0.0/16 network-node-01 $ docker run -d --net network-node-01 -p 80:8080 ekofr/http-ip .. Create a “network-node-01” Docker network and run “ekofr/http-ip” using this network. CONSUL (Machine) NODE #01
  • 15. NODE #02 > Machine (New tab) Terminal $ docker-machine create -d virtualbox --swarm --swarm-discovery="consul://$(docker-machine ip consul):8500" --engine-opt="cluster-store=consul://$(docker-machine ip consul):8500" --engine-opt="cluster-advertise=eth1:2376" swarm-node-02 .. Create the “swarm-node-02” machine under Docker and map Swarm discovery with Consul. CONSUL (Machine) NODE #01 NODE #02
  • 16. NODE #02 > Registrator Terminal $ eval $(docker-machine env swarm-node-02) $ docker run -d --volume=/var/run/docker.sock:/tmp/docker.sock gliderlabs/registrator -ip $(docker-machine ip swarm-node-02) consul://$(docker-machine ip consul):8500 .. Enter “swarm-node-02” machine and run a Registrator Docker image as a daemon. CONSUL (Machine) NODE #01 NODE #02
  • 17. NODE #02 > HTTP Container Terminal $ docker network create --subnet=172.19.0.0/16 network-node-02 $ docker run -d --net network-node-02 -p 80:8080 ekofr/http-ip .. Create a “network-node-02” Docker network and run “ekofr/http-ip” using this network. CONSUL (Machine) NODE #01 NODE #02
  • 18. What’s happening on DNS? Terminal $ dig @$(docker-machine ip consul) http-ip.service.consul .. ;; QUESTION SECTION: ;http-ip.service.consul. IN A ;; ANSWER SECTION: http-ip.service.consul. 0 IN A 192.168.99.100 http-ip.service.consul. 0 IN A 192.168.99.102 Let’s make a DNS call to ensure that our “http-ip” service is available under 2 machines! Shutdown them! DNS
  • 19. What’s happening on DNS? Terminal $ dig @$(docker-machine ip consul) http-ip.service.consul SRV .. ;; ANSWER SECTION: http-ip.service.consul. 0 IN SRV 1 1 80 c0a86366.addr.dc1.consul. http-ip.service.consul. 0 IN SRV 1 1 80 c0a86364.addr.dc1.consul. SRV records allows to define a priority and a weight for DNS entries but it is not supported by Consul at this time. You can find more information on SRV records on Wikipedia.
  • 20. Add DNS to your system Let’s make an HTTP call to ensure that both nodes answers. Add Consul DNS server as a resolver. CONSUL (Machine)
  • 21. Call HTTP service Terminal $ curl http://http-ip.service.consul hello from 172.18.0.2 $ curl http://http-ip.service.consul .. hello from 172.19.0.2 Now, perform your HTTP request and confirm that you are balanced between your two machines. HTTP DNS
  • 23. NODE #01 > Add a HTTP check Terminal $ eval $(docker-machine env swarm-node-01) $ docker kill $(docker ps -q --filter='ancestor=ekofr/http-ip') .. First, kill the docker container that runs ekofr/http-ip. We will launch it just after with a health check.
  • 24. NODE #01 > Add a HTTP check Terminal $ docker run -d --net network-node-01 -p 80:8080 -e SERVICE_CHECK_SCRIPT="curl -s -f http://$(docker-machine ip swarm-node-01)" -e SERVICE_CHECK_INTERVAL=5s -e SERVICE_CHECK_TIMEOUT=1s ekofr/http-ip .. Add a check to the ekofr/http-ip container. We add a HTTP check here but it could be what you want. More information about Registrator available environment variables here. More information on Consul check definition here.
  • 25. NODE #02 > Add a HTTP check Terminal $ eval $(docker-machine env swarm-node-02) $ docker kill $(docker ps -q --filter='ancestor=ekofr/http-ip') .. First, kill the docker container that runs ekofr/http-ip. We will launch it just after with a health check.
  • 26. NODE #02 > Add a HTTP check Terminal $ docker run -d --net network-node-02 -p 80:8080 -e SERVICE_CHECK_SCRIPT="curl -s -f http://$(docker-machine ip swarm-node-02)" -e SERVICE_CHECK_INTERVAL=5s -e SERVICE_CHECK_TIMEOUT=1s ekofr/http-ip .. Add a check to the ekofr/http-ip container. We add a HTTP check here but it could be what you want. More information about Registrator available environment variables here. More information on Consul check definition here.
  • 27. Check services health via web UI If you launch the UI, you should see your health checks:
  • 28. Check services health via API Terminal $ curl http://$(docker-machine ip consul):8500/v1/health/checks/http-ip .. [ { "Status": "passing", "Output": "hello from 172.18.0.2", "ServiceName": "http-ip", }, … ] Note that you can also check your services’s health via the Consul API “/health” endpoint: