SlideShare a Scribd company logo
1 of 26
Download to read offline
Container Cluster
Consul & Swarm
Eueung Mulyana
http://eueung.github.io/docker-stuff/consul
CodeLabs | Attribution-ShareAlike CC BY-SA
1 / 26
Outline
Consul - Introduction
RPI Swarm Cluster + Consul
2 / 26
Consul
Introduction
3 / 26
4 / 26
Consul
Consul is s a tool for discovering and con guring services in
our infrastructure.
Key Features
Service Discovery | Health Checking | Key/Value Store |
Multi Datacenter
Service Discovery
Clients of Consul can provide a service, such as api or mysql,
and other clients can use Consul to discover providers of a
given service. Using either DNS or HTTP, applications can
easily nd the services they depend upon.
Health Checking
Consul clients can provide any number of health checks,
either associated with a given service ("is the webserver
returning 200 OK"), or with the local node ("is memory
utilization below 90%"). This information can be used by an
operator to monitor cluster health, and it is used by the
service discovery components to route tra c away from
unhealthy hosts.
5 / 26
Key/Value Store
Applications can make use of Consul's hierarchical key/value
store for any number of purposes, including dynamic
con guration, feature agging, coordination, leader election,
and more. The simple HTTP API makes it easy to use.
Multi Datacenter
Consul supports multiple datacenters out of the box. This means
users of Consul do not have to worry about building additional
layers of abstraction to grow to multiple regions.
Ref: Introduction - Consul by HashiCorp
 
 
Architecture
Consul is a distributed, highly available
system.
Every node that provides services to Consul
runs a Consul agent. Running an agent is
not required for discovering other services
or getting/setting key/value data. The agent
is responsible for health checking the
services on the node as well as the node
itself.
6 / 26
The agents talk to one or more Consul servers. The Consul
servers are where data is stored and replicated. The servers
themselves elect a leader. While Consul can function with one
server, 3 to 5 is recommended to avoid failure scenarios leading
to data loss. A cluster of Consul servers is recommended for
each datacenter.
Components of your infrastructure that need to discover other
services or nodes can query any of the Consul servers or any of
the Consul agents. The agents forward queries to the servers
automatically.
Each datacenter runs a cluster of Consul servers. When a cross-
datacenter service discovery or con guration request is made,
the local Consul servers forward the request to the remote
datacenter and return the result.
Ref: Introduction - Consul by HashiCorp
7 / 26
RPI Swarm Cluster + Consul
8 / 26
Let's rebuild our previous container cluster
with Consul..
Check it again if necessary: Docker Swarm Cluster
9 / 26
10 / 26
A 3-Node RPI
Cluster
node1
192.168.1.102
node2
192.168.1.101
node3
192.168.1.100
$ssh-keygen-Rnode1.local
$ssh-copy-id-oStrictHostKeyChecking=no-oCheckHostIP=noroot@$node1.local
#ifnecessary
$ssh-oStrictHostKeyChecking=no-oCheckHostIP=noroot@$node1.local
$ssh-keygen-R192.168.1.102
11 / 26
A Note
SSH Setting
#etc/default/docker
DOCKER_OPTS="--storage-driver=overlay-D-Htcp://0.0.0.0:2375--cluster-st
#ifnecessary
$systemctlrestartdocker
$dockerinfo
$psaux|grepdocker
12 / 26
Engine Config
DOCKER_OPTS
$./start.shnode1.local
#start.sh
functiongetip(){(traceroute$12>&1|head-n1|cut-d(-f2|cut
IP_ADDRESS=$(getip$1)
echo$IP_ADDRESS
docker-H$IP_ADDRESS:2375run
-d--net=host--name=consul
-v/data-p8500:8500
hypriot/rpi-consul:0.6.4agent-server-data-dir/data-bootstrap-expect
-ui-dir=/ui
-advertise=$IP_ADDRESS-bind=$IP_ADDRESS-client=$IP_ADDRESS
docker-H$IP_ADDRESS:2375run
-d-p10000:6000--name=swarm-master
hypriot/rpi-swarm:1.2.1manage-H0.0.0.0:6000
--discovery-opt="kv.path=docker/nodes"
consul://$IP_ADDRESS:8500
13 / 26
Start Consul &
Swarm Master
$exportDOCKER_HOST=tcp://192.168.1.102:10000
$dockerrun-d-p8080:80hypriot/rpi-nano-httpd
571d31928b3db90fc6baffa088c25c645f8d55d5e144dc03816ef5f6af62ae21
$dockerps
CONTAINERID IMAGE COMMAND CRE
571d31928b3d hypriot/rpi-nano-httpd "/httpd80" 8
d897b5aeab29 hypriot/rpi-swarm:1.2.1 "/swarmmanage-H0.0"
dc1bb0bd5188 hypriot/rpi-consul:0.6.4 "/consulagent-serve"
14 / 26
Check & Test
$dockerinfo
Containers:3
Running:3-Paused:0-Stopped:0
Images:11
ServerVersion:swarm/1.2.1
Role:primary
Strategy:spread
Filters:health,port,containerslots,dependency,affinity,constraint
Nodes:3
node1:192.168.1.102:2375
-ID:ASSH:N743:XQ4D:2B3A:LQA6:ESIO:PHBI:RPN7:NWMP:5WK2:4X4F:WNY5-Statu
-Containers:2
-ReservedCPUs:0/4
-ReservedMemory:0B/971.8MiB
-Labels:executiondriver=native-0.2,kernelversion=4.1.17-hypriotos-v7+,
-Error:(none)-UpdatedAt:2016-05-15T08:34:02Z
-ServerVersion:1.10.2
node2:192.168.1.101:2375
-Containers:1
-ReservedCPUs:0/4
-ReservedMemory:0B/971.8MiB
node3:192.168.1.100:2375
-Containers:0
-ReservedCPUs:0/4
-ReservedMemory:0B/971.8MiB
...
KernelVersion:4.1.17-hypriotos-v7+-OperatingSystem:linux-Architectu
CPUs:12
TotalMemory:2.847GiB
Name:d897b5aeab29
15 / 26
Check & Test
Consul UI
 
16 / 26
Consul UI
 
17 / 26
Consul UI
 
18 / 26
$dockerrun-d-p9000:9000hypriot/rpi-dockerui:v0.9.0-ehttp://192.168
a08588d3e7888952875e9f14496ccf5e943af954a8e70a4c51439025ff31a943
$dockerps
CONTAINERID IMAGE COMMAND CRE
a08588d3e788 hypriot/rpi-dockerui "/dockerui-ehttp://" 6
571d31928b3d hypriot/rpi-nano-httpd "/httpd80" Abo
d897b5aeab29 hypriot/rpi-swarm:1.2.1 "/swarmmanage-H0.0" Abo
dc1bb0bd5188 hypriot/rpi-consul:0.6.4 "/consulagent-serve" Abo
19 / 26
Now: UI for Docker
Try DockerUI
DockerUI
 
20 / 26
DockerUI
 
21 / 26
DockerUI
 
22 / 26
DockerUI
 
23 / 26
Refs
24 / 26
Refs
1. Introduction - Consul by HashiCorp
2. Consul Architecture - Consul by HashiCorp
3. kevana/ui-for-docker: An uno cial web interface for Docker, formerly known
as DockerUI
4. consul @ docker hub
5. progrium/consul @ docker hub
6. gliderlabs/consul @ docker hub | consul-agent | consul-server
25 / 26
END
Eueung Mulyana
http://eueung.github.io/docker-stuff/consul
CodeLabs | Attribution-ShareAlike CC BY-SA
26 / 26

More Related Content

What's hot

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.
 

What's hot (20)

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
 
Swarm - A Docker Clustering System
Swarm - A Docker Clustering SystemSwarm - A Docker Clustering System
Swarm - A Docker Clustering System
 
Docker Swarm & Machine
Docker Swarm & MachineDocker Swarm & Machine
Docker Swarm & Machine
 
Docker Machine & Docker Swarm
Docker Machine & Docker SwarmDocker Machine & Docker Swarm
Docker Machine & Docker Swarm
 
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
 
Clustering with Docker Swarm - Dockerops 2016 @ Cento (FE) Italy
Clustering with Docker Swarm - Dockerops 2016 @ Cento (FE) ItalyClustering with Docker Swarm - Dockerops 2016 @ Cento (FE) Italy
Clustering with Docker Swarm - Dockerops 2016 @ Cento (FE) Italy
 
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...
 
Introduction to docker swarm
Introduction to docker swarmIntroduction to docker swarm
Introduction to docker swarm
 
Docker swarm
Docker swarmDocker swarm
Docker swarm
 
Docker 1.12 and swarm mode
Docker 1.12 and swarm modeDocker 1.12 and swarm mode
Docker 1.12 and swarm mode
 
Nebulaworks Docker Overview 09-22-2015
Nebulaworks Docker Overview 09-22-2015Nebulaworks Docker Overview 09-22-2015
Nebulaworks Docker Overview 09-22-2015
 
Service discovery in Docker environments
Service discovery in Docker environmentsService discovery in Docker environments
Service discovery in Docker environments
 
Docker 1.11 @ Docker SF Meetup
Docker 1.11 @ Docker SF MeetupDocker 1.11 @ Docker SF Meetup
Docker 1.11 @ Docker SF Meetup
 
What's New in Docker 1.12?
What's New in Docker 1.12?What's New in Docker 1.12?
What's New in Docker 1.12?
 
AtlasCamp 2015: The age of orchestration: From Docker basics to cluster manag...
AtlasCamp 2015: The age of orchestration: From Docker basics to cluster manag...AtlasCamp 2015: The age of orchestration: From Docker basics to cluster manag...
AtlasCamp 2015: The age of orchestration: From Docker basics to cluster manag...
 
Multi container apps swarm + consul + compose
Multi container apps   swarm + consul + composeMulti container apps   swarm + consul + compose
Multi container apps swarm + consul + compose
 
Going Production with Docker and Swarm
Going Production with Docker and SwarmGoing Production with Docker and Swarm
Going Production with Docker and Swarm
 
CoreOS Overview and Current Status
CoreOS Overview and Current StatusCoreOS Overview and Current Status
CoreOS Overview and Current Status
 

Similar to Consul and docker swarm cluster

The Role of Elastic Load Balancer - Apache Stratos
The Role of Elastic Load Balancer - Apache StratosThe Role of Elastic Load Balancer - Apache Stratos
The Role of Elastic Load Balancer - Apache Stratos
Imesh Gunaratne
 

Similar to Consul and docker swarm cluster (20)

Getting Started with Consul
Getting Started with ConsulGetting Started with Consul
Getting Started with Consul
 
Consul and Consul Pusher
Consul and Consul PusherConsul and Consul Pusher
Consul and Consul Pusher
 
MuleSoft Meetup Roma - Runtime Fabric Series (From Zero to Hero) - Sessione 2
MuleSoft Meetup Roma - Runtime Fabric Series (From Zero to Hero) - Sessione 2MuleSoft Meetup Roma - Runtime Fabric Series (From Zero to Hero) - Sessione 2
MuleSoft Meetup Roma - Runtime Fabric Series (From Zero to Hero) - Sessione 2
 
Microservices with Spring
Microservices with SpringMicroservices with Spring
Microservices with Spring
 
Introduction to Consul
Introduction to ConsulIntroduction to Consul
Introduction to Consul
 
Docker Swarm secrets for creating great FIWARE platforms
Docker Swarm secrets for creating great FIWARE platformsDocker Swarm secrets for creating great FIWARE platforms
Docker Swarm secrets for creating great FIWARE platforms
 
Cluster computings
Cluster computingsCluster computings
Cluster computings
 
The Role of Elastic Load Balancer - Apache Stratos
The Role of Elastic Load Balancer - Apache StratosThe Role of Elastic Load Balancer - Apache Stratos
The Role of Elastic Load Balancer - Apache Stratos
 
Intro to Kubernetes
Intro to KubernetesIntro to Kubernetes
Intro to Kubernetes
 
Pivotal CF on Vblock Systems
Pivotal CF on Vblock  Systems Pivotal CF on Vblock  Systems
Pivotal CF on Vblock Systems
 
Red Hat multi-cluster management & what's new in OpenShift
Red Hat multi-cluster management & what's new in OpenShiftRed Hat multi-cluster management & what's new in OpenShift
Red Hat multi-cluster management & what's new in OpenShift
 
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)
 
Service Discovery with Consul - Arunvel Arunachalam
Service Discovery with Consul  - Arunvel Arunachalam Service Discovery with Consul  - Arunvel Arunachalam
Service Discovery with Consul - Arunvel Arunachalam
 
Designing High Availability for HashiCorp Vault in AWS
Designing High Availability for HashiCorp Vault in AWSDesigning High Availability for HashiCorp Vault in AWS
Designing High Availability for HashiCorp Vault in AWS
 
MuleSoft Meetup Vancouver 5th Virtual Event
MuleSoft Meetup Vancouver 5th Virtual EventMuleSoft Meetup Vancouver 5th Virtual Event
MuleSoft Meetup Vancouver 5th Virtual Event
 
Framework Agnostic Discovery
Framework Agnostic DiscoveryFramework Agnostic Discovery
Framework Agnostic Discovery
 
Comparison of Current Service Mesh Architectures
Comparison of Current Service Mesh ArchitecturesComparison of Current Service Mesh Architectures
Comparison of Current Service Mesh Architectures
 
Cohesive Networks Support Docs: VNS3 version 3.5+ API Guide
Cohesive Networks Support Docs: VNS3 version 3.5+ API Guide Cohesive Networks Support Docs: VNS3 version 3.5+ API Guide
Cohesive Networks Support Docs: VNS3 version 3.5+ API Guide
 
A Survey of Performance Comparison between Virtual Machines and Containers
A Survey of Performance Comparison between Virtual Machines and ContainersA Survey of Performance Comparison between Virtual Machines and Containers
A Survey of Performance Comparison between Virtual Machines and Containers
 
MuleSoft Surat Meetup#42 - Runtime Fabric Manager on Self Managed Kubernetes ...
MuleSoft Surat Meetup#42 - Runtime Fabric Manager on Self Managed Kubernetes ...MuleSoft Surat Meetup#42 - Runtime Fabric Manager on Self Managed Kubernetes ...
MuleSoft Surat Meetup#42 - Runtime Fabric Manager on Self Managed Kubernetes ...
 

More from Eueung Mulyana

More from Eueung Mulyana (20)

FGD Big Data
FGD Big DataFGD Big Data
FGD Big Data
 
Hyper-Connectivity and Data Proliferation - Ecosystem Perspective
Hyper-Connectivity and Data Proliferation - Ecosystem PerspectiveHyper-Connectivity and Data Proliferation - Ecosystem Perspective
Hyper-Connectivity and Data Proliferation - Ecosystem Perspective
 
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated WorldIndustry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
 
Blockchain Introduction
Blockchain IntroductionBlockchain Introduction
Blockchain Introduction
 
Bringing Automation to the Classroom: A ChatOps-Based Approach
Bringing Automation to the Classroom: A ChatOps-Based ApproachBringing Automation to the Classroom: A ChatOps-Based Approach
Bringing Automation to the Classroom: A ChatOps-Based Approach
 
FinTech & Cryptocurrency Introduction
FinTech & Cryptocurrency IntroductionFinTech & Cryptocurrency Introduction
FinTech & Cryptocurrency Introduction
 
Open Source Networking Overview
Open Source Networking OverviewOpen Source Networking Overview
Open Source Networking Overview
 
ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments
 
Open stack pike-devstack-tutorial
Open stack pike-devstack-tutorialOpen stack pike-devstack-tutorial
Open stack pike-devstack-tutorial
 
Basic onos-tutorial
Basic onos-tutorialBasic onos-tutorial
Basic onos-tutorial
 
ONOS SDN Controller - Introduction
ONOS SDN Controller - IntroductionONOS SDN Controller - Introduction
ONOS SDN Controller - Introduction
 
OpenDaylight SDN Controller - Introduction
OpenDaylight SDN Controller - IntroductionOpenDaylight SDN Controller - Introduction
OpenDaylight SDN Controller - Introduction
 
Mininet Basics
Mininet BasicsMininet Basics
Mininet Basics
 
Android Programming Basics
Android Programming BasicsAndroid Programming Basics
Android Programming Basics
 
Cloud Computing: Overview and Examples
Cloud Computing: Overview and ExamplesCloud Computing: Overview and Examples
Cloud Computing: Overview and Examples
 
selected input/output - sensors and actuators
selected input/output - sensors and actuatorsselected input/output - sensors and actuators
selected input/output - sensors and actuators
 
Connected Things, IoT and 5G
Connected Things, IoT and 5GConnected Things, IoT and 5G
Connected Things, IoT and 5G
 
Connectivity for Local Sensors and Actuators Using nRF24L01+
Connectivity for Local Sensors and Actuators Using nRF24L01+Connectivity for Local Sensors and Actuators Using nRF24L01+
Connectivity for Local Sensors and Actuators Using nRF24L01+
 
NodeMCU with Blynk and Firebase
NodeMCU with Blynk and FirebaseNodeMCU with Blynk and Firebase
NodeMCU with Blynk and Firebase
 
Trends and Enablers - Connected Services and Cloud Computing
Trends and Enablers  - Connected Services and Cloud ComputingTrends and Enablers  - Connected Services and Cloud Computing
Trends and Enablers - Connected Services and Cloud Computing
 

Recently uploaded

Recently uploaded (20)

CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 

Consul and docker swarm cluster