SlideShare a Scribd company logo
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

PPTX
Docker cluster with swarm, consul, registrator and consul-template
PPTX
Introction to docker swarm
PPTX
Docker Networking & Swarm Mode Introduction
PDF
Docker Swarm 0.2.0
PDF
The age of orchestration: from Docker basics to cluster management
PDF
Swarm mode
PDF
Deploying and Scaling a Rails Application with Docker and Friends
PDF
Docker swarm introduction
Docker cluster with swarm, consul, registrator and consul-template
Introction to docker swarm
Docker Networking & Swarm Mode Introduction
Docker Swarm 0.2.0
The age of orchestration: from Docker basics to cluster management
Swarm mode
Deploying and Scaling a Rails Application with Docker and Friends
Docker swarm introduction

What's hot (20)

PPTX
Docker Swarm for Beginner
PPTX
Docker Swarm Introduction
PPTX
Swarm - A Docker Clustering System
PDF
Docker Swarm & Machine
PPTX
Docker Machine & Docker Swarm
PPTX
Load Balancing Apps in Docker Swarm with NGINX
PDF
Dockercon Swarm Updated
PDF
Clustering with Docker Swarm - Dockerops 2016 @ Cento (FE) Italy
PDF
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...
PPTX
Introduction to docker swarm
PDF
PDF
Docker 1.12 and swarm mode
PDF
Nebulaworks Docker Overview 09-22-2015
PDF
Service discovery in Docker environments
PDF
Docker 1.11 @ Docker SF Meetup
PDF
What's New in Docker 1.12?
PDF
AtlasCamp 2015: The age of orchestration: From Docker basics to cluster manag...
PDF
Multi container apps swarm + consul + compose
PDF
Going Production with Docker and Swarm
PPTX
CoreOS Overview and Current Status
Docker Swarm for Beginner
Docker Swarm Introduction
Swarm - A Docker Clustering System
Docker Swarm & Machine
Docker Machine & Docker Swarm
Load Balancing Apps in Docker Swarm with NGINX
Dockercon Swarm Updated
Clustering with Docker Swarm - Dockerops 2016 @ Cento (FE) Italy
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...
Introduction to docker swarm
Docker 1.12 and swarm mode
Nebulaworks Docker Overview 09-22-2015
Service discovery in Docker environments
Docker 1.11 @ Docker SF Meetup
What's New in Docker 1.12?
AtlasCamp 2015: The age of orchestration: From Docker basics to cluster manag...
Multi container apps swarm + consul + compose
Going Production with Docker and Swarm
CoreOS Overview and Current Status
Ad

Similar to Consul and docker swarm cluster (20)

PDF
Getting Started with Consul
PDF
Consul and Consul Pusher
PDF
MuleSoft Meetup Roma - Runtime Fabric Series (From Zero to Hero) - Sessione 2
PPTX
Microservices with Spring
PDF
Introduction to Consul
PPTX
Docker Swarm secrets for creating great FIWARE platforms
PPTX
Cluster computings
PDF
The Role of Elastic Load Balancer - Apache Stratos
PDF
Intro to Kubernetes
PDF
Pivotal CF on Vblock Systems
 
PDF
Red Hat multi-cluster management & what's new in OpenShift
PDF
Service discovery like a pro (presented at reversimX)
PPTX
Service Discovery with Consul - Arunvel Arunachalam
PPTX
Designing High Availability for HashiCorp Vault in AWS
PPTX
MuleSoft Meetup Vancouver 5th Virtual Event
PDF
Framework Agnostic Discovery
PDF
Comparison of Current Service Mesh Architectures
PDF
Cohesive Networks Support Docs: VNS3 version 3.5+ API Guide
PDF
A Survey of Performance Comparison between Virtual Machines and Containers
PDF
MuleSoft Surat Meetup#42 - Runtime Fabric Manager on Self Managed Kubernetes ...
Getting Started with Consul
Consul and Consul Pusher
MuleSoft Meetup Roma - Runtime Fabric Series (From Zero to Hero) - Sessione 2
Microservices with Spring
Introduction to Consul
Docker Swarm secrets for creating great FIWARE platforms
Cluster computings
The Role of Elastic Load Balancer - Apache Stratos
Intro to Kubernetes
Pivotal CF on Vblock Systems
 
Red Hat multi-cluster management & what's new in OpenShift
Service discovery like a pro (presented at reversimX)
Service Discovery with Consul - Arunvel Arunachalam
Designing High Availability for HashiCorp Vault in AWS
MuleSoft Meetup Vancouver 5th Virtual Event
Framework Agnostic Discovery
Comparison of Current Service Mesh Architectures
Cohesive Networks Support Docs: VNS3 version 3.5+ API Guide
A Survey of Performance Comparison between Virtual Machines and Containers
MuleSoft Surat Meetup#42 - Runtime Fabric Manager on Self Managed Kubernetes ...
Ad

More from Eueung Mulyana (20)

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

Recently uploaded (20)

PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
Advanced IT Governance
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Cloud computing and distributed systems.
PDF
Modernizing your data center with Dell and AMD
PDF
Approach and Philosophy of On baking technology
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Electronic commerce courselecture one. Pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
PDF
cuic standard and advanced reporting.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Understanding_Digital_Forensics_Presentation.pptx
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
Advanced IT Governance
20250228 LYD VKU AI Blended-Learning.pptx
Chapter 3 Spatial Domain Image Processing.pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Cloud computing and distributed systems.
Modernizing your data center with Dell and AMD
Approach and Philosophy of On baking technology
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Per capita expenditure prediction using model stacking based on satellite ima...
Electronic commerce courselecture one. Pdf
The AUB Centre for AI in Media Proposal.docx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
cuic standard and advanced reporting.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...

Consul and docker swarm cluster