Slide 1

Slide 1 text

CONSUL AS A MONITORING SERVICE

Slide 2

Slide 2 text

SETH VARGO @sethvargo

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

SERVICE ORIENTED ARCHITECTURE

Slide 5

Slide 5 text

SOA  PRIMER Autonomous Limited Scope Loose Coupling

Slide 6

Slide 6 text

ORDER PROCESSING WEB APP ORDER HISTORY FORECASTING

Slide 7

Slide 7 text

ORDER PROCESSING WEB APP DISCOVERY Which nodes are part of "order processing"?

Slide 8

Slide 8 text

ORDER PROCESSING WEB APP LOAD  BALANCING How to ensure request leveling across providers? NODE 1 NODE 2 NODE N

Slide 9

Slide 9 text

ORDER PROCESSING WEB APP ANTI-­‐PATTERN Load Balancer is a Single Point of Failure (SPOF) NODE 1 NODE 2 NODE N LOAD BALANCER

Slide 10

Slide 10 text

ORDER PROCESSING WEB APP HEALTH  CHECKING How to avoid routing to unhealthy hosts? NODE 1 NODE 2 NODE 3 LOAD BALANCER

Slide 11

Slide 11 text

WEB APP CONFIGURATION How to efficiently push dynamic configuration? WEB 1 WEB 2 WEB N maintenance: false feature_a: true role: "web"

Slide 12

Slide 12 text

SERVICE   DISCOVERY LOAD   BALANCING HEALTH   CHECKING KEY-­‐VALUE   CONFIGURATION 4  BASIC  PROBLEMS

Slide 13

Slide 13 text

ZOOKEEPER ETCD SENSU SMART  STACK EXISTING  "SOLUTIONS" http://consul.io/intro/vs

Slide 14

Slide 14 text

CONSUL

Slide 15

Slide 15 text

Service Discovery HTTP + DNS

Slide 16

Slide 16 text

demo  master dig web-frontend.service.consul

Slide 17

Slide 17 text

; <<>> DiG 9.8.3-P1 <<>> web-frontend.service.consul. ANY ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29981 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;web-frontend.service.consul. IN ANY ;; ANSWER SECTION: web-frontend.service.consul. 0 IN A 10.0.3.83 web-frontend.service.consul. 0 IN A 10.0.1.109 demo  master dig web-frontend.service.consul

Slide 18

Slide 18 text

Datacenter Aware

Slide 19

Slide 19 text

CLIENT CLIENT CLIENT CLIENT CLIENT CLIENT SERVER SERVER SERVER REPLICATION REPLICATION RPC RPC LAN  GOSSIP

Slide 20

Slide 20 text

CLIENT CLIENT CLIENT CLIENT CLIENT CLIENT SERVER SERVER SERVER REPLICATION REPLICATION RPC RPC LAN  GOSSIP SERVER SERVER SERVER REPLICATION REPLICATION

Slide 21

Slide 21 text

CLIENT CLIENT CLIENT CLIENT CLIENT CLIENT SERVER SERVER SERVER REPLICATION REPLICATION RPC RPC LAN  GOSSIP SERVER SERVER SERVER REPLICATION REPLICATION WAN  GOSSIP

Slide 22

Slide 22 text

Host & Service Level Health Checks

Slide 23

Slide 23 text

> listen http-in bind *:8000 server web-0 127.0.0.1:80 server web-1 127.0.0.1:80 server web-2 127.0.0.1:80 demo  master consul-template -template="example.ctmpl" -dry demo  master

Slide 24

Slide 24 text

> listen http-in bind *:8000 server web-0 127.0.0.1:80 server web-1 127.0.0.1:80 server web-2 127.0.0.1:80 demo  master consul-template -template="example.ctmpl" -dry demo  master sudo stop webserver

Slide 25

Slide 25 text

> listen http-in bind *:8000 server web-1 127.0.0.1:80 server web-2 127.0.0.1:80 demo  master consul-template -template="example.ctmpl" -dry demo  master sudo stop webserver

Slide 26

Slide 26 text

> listen http-in bind *:8000 server web-0 127.0.0.1:80 server web-1 127.0.0.1:80 server web-2 127.0.0.1:80 demo  master consul-template -template="example.ctmpl" -dry demo  master sudo start webserver

Slide 27

Slide 27 text

K/V Store HTTP API

Slide 28

Slide 28 text

true demo  master curl -X PUT -d 'bar' http://localhost:8500/v1/kv/foo

Slide 29

Slide 29 text

true demo  master curl -X PUT -d 'bar' http://localhost:8500/v1/kv/foo [ { "CreateIndex": 100, "ModifyIndex": 200, "Key": "foo", "Flags": 0, "Value": "YmFy" } ] demo  master curl http://localhost:8500/v1/kv/foo

Slide 30

Slide 30 text

TRUSTED  BY

Slide 31

Slide 31 text

HEALTH CHECKS

Slide 32

Slide 32 text

WHAT  IS  A  CHECK? Any command that returns an exit code

Slide 33

Slide 33 text

WHAT  IS  A  CHECK? Any command that returns an exit code 0 PASSING 1 WARNING __ FAILING

Slide 34

Slide 34 text

WHAT  IS  A  CHECK? Output is captured as a "note" for inspection curl: (7) Failed to connect to 127.0.0.1 port 4455: Connection refused $ curl http://127.0.0.1:4455/_health

Slide 35

Slide 35 text

CREATING  A  CHECK Use a custom script { "check": { "id": "mem-util", "name": "Memory utilization", "script": "/usr/local/bin/check_mem.py", "interval": "10s" } }

Slide 36

Slide 36 text

CREATING  A  CHECK Use a built-in check type { "check": { "id": "api", "name": "HTTP API on port 4455", "http": "http://localhost:4455/_health", "interval": "10s", "timeout": "1s" } }

Slide 37

Slide 37 text

RESPONSIVE

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

MONITORING SERVICE TRADITIONAL  MONITORING Pushes information into a silo WEB 1 WEB 2 WEB N

Slide 41

Slide 41 text

MONITORING SERVICE TRADITIONAL  MONITORING Pushes information into a silo WEB 1 WEB 2 WEB N

Slide 42

Slide 42 text

MONITORING SERVICE TRADITIONAL  MONITORING Pushes information into a silo WEB 1 WEB 2 WEB N

Slide 43

Slide 43 text

MONITORING SERVICE TRADITIONAL  MONITORING Pushes information into a silo WEB 1 WEB 2 WEB N

Slide 44

Slide 44 text

MONITORING SERVICE TRADITIONAL  MONITORING Pushes information into a silo WEB 1 WEB 2 WEB N U

Slide 45

Slide 45 text

MONITORING SERVICE TRADITIONAL  MONITORING Pushes information into a silo WEB 1 WEB 2 WEB N U F F

Slide 46

Slide 46 text

MONITORING SERVICE TRADITIONAL  MONITORING Pushes information into a silo WEB 1 WEB 2 WEB N U F F

Slide 47

Slide 47 text

CONSUL CONSUL  MONITORING Removes unhealthy nodes from service discovery layer WEB 1 WEB 2 WEB N

Slide 48

Slide 48 text

CONSUL CONSUL  MONITORING Removes unhealthy nodes from service discovery layer WEB 1 WEB 2 WEB N

Slide 49

Slide 49 text

CONSUL CONSUL  MONITORING Removes unhealthy nodes from service discovery layer WEB 1 WEB 2 WEB N dig web.service.consul 10.0.1.4 10.0.1.5 10.0.1.6

Slide 50

Slide 50 text

CONSUL CONSUL  MONITORING Removes unhealthy nodes from service discovery layer WEB 1 WEB 2 WEB N dig web.service.consul 10.0.1.4 10.0.1.5 10.0.1.6

Slide 51

Slide 51 text

CONSUL CONSUL  MONITORING Removes unhealthy nodes from service discovery layer WEB 1 WEB 2 WEB N dig web.service.consul 10.0.1.5 10.0.1.6

Slide 52

Slide 52 text

CONSUL CONSUL  MONITORING Removes unhealthy nodes from service discovery layer WEB 1 WEB 2 WEB N dig web.service.consul 10.0.1.5 10.0.1.6 host: web.service.consul

Slide 53

Slide 53 text

CONSUL CONSUL  MONITORING Removes unhealthy nodes from service discovery layer WEB 1 WEB 2 WEB N dig web.service.consul 10.0.1.5 10.0.1.6 host: web.service.consul

Slide 54

Slide 54 text

CONSUL CONSUL  MONITORING Removes unhealthy nodes from service discovery layer WEB 1 WEB 2 WEB N dig web.service.consul 10.0.1.5 10.0.1.6 host: web.service.consul

Slide 55

Slide 55 text

CONSUL CONSUL  MONITORING Removes unhealthy nodes from service discovery layer WEB 1 WEB 2 WEB N dig web.service.consul 10.0.1.5 10.0.1.6 host: web.service.consul

Slide 56

Slide 56 text

CONSUL CONSUL  MONITORING Removes unhealthy nodes from service discovery layer WEB 1 WEB 2 WEB N dig web.service.consul 10.0.1.4 10.0.1.5 10.0.1.6 host: web.service.consul

Slide 57

Slide 57 text

CONSUL  MONITORING Unhealthy nodes are not returned from DNS queries dig web.service.consul web-01, web-02, web-03

Slide 58

Slide 58 text

CONSUL  MONITORING Unhealthy nodes are not returned from HTTP API curl /v1/services/web web-01, web-02, web-03

Slide 59

Slide 59 text

LOCKING

Slide 60

Slide 60 text

CONSUL  LOCK Allows for a new kind of "HA" demo  master consul lock [options] prefix child...

Slide 61

Slide 61 text

CONSUL  LOCK Making standby HA much simpler CONSUL VAULT 1 VAULT 2 VAULT 3

Slide 62

Slide 62 text

CONSUL  LOCK Making standby HA much simpler CONSUL VAULT 1 VAULT 2 VAULT 3 L L

Slide 63

Slide 63 text

CONSUL  LOCK Making standby HA much simpler CONSUL VAULT 1 VAULT 2 VAULT 3 L

Slide 64

Slide 64 text

CONSUL  LOCK Making standby HA much simpler CONSUL VAULT 1 VAULT 2 VAULT 3 L LEADER  ELECTION

Slide 65

Slide 65 text

CONSUL  LOCK Making standby HA much simpler CONSUL VAULT 1 VAULT 2 VAULT 3 L GET /secret/foo REQUEST

Slide 66

Slide 66 text

CONSUL  LOCK Making standby HA much simpler CONSUL VAULT 1 VAULT 2 VAULT 3 L GET /secret/foo REQUEST

Slide 67

Slide 67 text

CONSUL  LOCK Making standby HA much simpler CONSUL VAULT 1 VAULT 2 VAULT 3 L GET /secret/foo REQUEST

Slide 68

Slide 68 text

CONSUL  LOCK Making standby HA much simpler CONSUL VAULT 1 VAULT 2 VAULT 3 L

Slide 69

Slide 69 text

CONSUL  LOCK Making standby HA much simpler CONSUL VAULT 1 VAULT 2 VAULT 3 l

Slide 70

Slide 70 text

CONSUL  LOCK Making standby HA much simpler CONSUL VAULT 1 VAULT 2 VAULT 3 L

Slide 71

Slide 71 text

CONSUL  LOCK Making standby HA much simpler CONSUL VAULT 1 VAULT 2 VAULT 3 L

Slide 72

Slide 72 text

CONSUL  LOCK Making standby HA much simpler VAULT 1 VAULT 2 VAULT 3 GET /secret/foo REQUEST CONSUL L

Slide 73

Slide 73 text

CONSUL  LOCK Making standby HA much simpler VAULT 1 VAULT 2 VAULT 3 GET /secret/foo REQUEST CONSUL L

Slide 74

Slide 74 text

CONSUL  LOCK Solves the "exactly one of these must always be running" problem

Slide 75

Slide 75 text

CONSUL  LOCK Also great as a semaphore - rolling restarts

Slide 76

Slide 76 text

SCALABILITY

Slide 77

Slide 77 text

MONITORING SERVICE TRADITIONAL  MONITORING Notifies/polls all statuses WEB 1 WEB 2 WEB N "I'm healthy" "Good, thanks for asking!"

Slide 78

Slide 78 text

MONITORING SERVICE TRADITIONAL  MONITORING Notifies/polls all statuses WEB 1 WEB 2 WEB 1,000 1,000'S OF REQUESTS

Slide 79

Slide 79 text

MONITORING SERVICE TRADITIONAL  MONITORING Notifies/polls all statuses WEB 1 WEB 2 WEB 1,000 1,000'S OF REQUESTS HA

Slide 80

Slide 80 text

CONSUL WEB 1 WEB 2 WEB N My status has changed CONSUL  MONITORING Notifies on status changes

Slide 81

Slide 81 text

CONSUL CONSUL  MONITORING Notifies on status changes WEB 1 WEB 2 WEB 1,000 10'S OF REQUESTS

Slide 82

Slide 82 text

CONCLUSION

Slide 83

Slide 83 text

SERVICE   DISCOVERY LOAD   BALANCING HEALTH   CHECKING KEY-­‐VALUE   CONFIGURATION SOLVES  4  BASIC  PROBLEMS

Slide 84

Slide 84 text

9 H G L RESPONSIVE LEADER   ELECTION SEMAPHORE   LOCKING SCALABLE SOLVES  4  MORE  PROBLEMS

Slide 85

Slide 85 text

SETH VARGO @sethvargo QUESTIONS?