how we cooked elasticsearch, consul, haproxy and dns-recursor

30
How we cooked Elasticsearch, Consul, Haproxy and DNS-recursor In comic strip Authors: Shcherbakov S. Sin A. Tokarev O.

Upload: oleg-tokarev

Post on 12-Apr-2017

3.163 views

Category:

Software


1 download

TRANSCRIPT

Page 1: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

How we cooked Elasticsearch, Consul,Haproxy and DNS-recursor

In comic strip

Authors:Shcherbakov S.

Sin A.Tokarev O.

Page 2: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

DNS

I resolve my elasticsearch location by DNS

And send request to it

Gimme my data!

Whe

re is

my

Ela

stic

sear

ch?

Page 3: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

What happens if Elasticsearch down?

Page 4: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

DNSW

here

is m

y E

last

icse

arch

?

Page 5: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

Ok. I will hide my Elasticsearch(es) behind HAproxy!!!

Page 6: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

Data request

Service monitoring

Page 7: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

DNS

Ok. Now I can access my data even if one of elasticsearch is down!

Gimme my data!

Whe

re is

my

Ela

stic

sear

ch?

Page 8: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

DNSW

here

is m

y E

last

icse

arch

?

^#%$*&#%*%@*&%##*&$%399493

Page 9: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

Ok. Let's add extra balancer for redundancy!

Page 10: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

DNS

Ok. Now DNS points to one of balancer.But what will happen

if one of balancer down??

Gimme my data!

{OR}

Whe

re is

my

Ela

stic

sear

ch?

Page 11: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

DNSW

here

is m

y E

last

icse

arch

?

Gimme my data!

Page 12: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

DNS

Whe

re is

my

Ela

stic

sear

ch?

Gim

me

my

data

!

Page 13: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

DNSW

here

is m

y E

last

icse

arch

?

Gimme my data!

It makes me crazythat DNS continues give me

An address of brokenserver

Page 14: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

How to make DNS forget broken balancer serverASAP?!?

Page 15: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

Make Consul cluster monitor your balancers healthand inform your NS about IPs of health ones

(Yep, Consul can speak in DNS language)

Page 16: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

DNS

Forward zone

Consul cluster

Ok! Now if one of my balancer downConsul will return IPs of health ones only

Consul is authoritative for a zonewith my critical services

Page 17: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

Not enough thermometers???

Page 18: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

DNS

Consul clusterNotify Admin!

Retrieve services IPs

Page 19: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

Three safety loops

Node level

Disaster notifications

(zabbix)

Application lo-level

Automated application cluster load balancing

(HAproxy)

Application hi-level

Automated application address discovering

(Consul, DNS recursor)

Page 20: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

Do you thing that it is the DNS server that is the Single Point of Failure?

Page 21: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

ZABBIX!!!

But it does not affect any component of production system directlyNeither customers are affected

As for DNS servers they can be readily deployed in required amountwith resolv.conf updated with new servers IPs

Page 22: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

DNS

Still works..NOT BAD!!

Page 23: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor
Page 24: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

HAproxy

/etc/haproxy/haproxy.cfg

frontend elasticsearch bind *:9200 default_backend elasticsearch

backend elasticsearch server es01 123.123.123.1:9200 check inter 1000 rise 10 fall 5 server es02 123.123.123.2:9200 check inter 1000 rise 10 fall 5 server es03 123.123.123.3:9200 check inter 1000 rise 10 fall 5 option httpchk GET /_cluster/health http-check expect ! string "status":"red"

Page 25: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

Consul agent (on HAproxy nodes)/opt/consul/config/srv-es-lb.json

{ "service": { "name": "es-lb", "port": 9200, "checks": [ { "interval": "5s", "http": "http://localhost:9200", "timeout": "1s" } ] }}

Page 26: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

Consul looks like as NS from outside

[root@consul01 ~]# dig @consul01 -p 8600 es-lb.service.martyshka +short185.66.251.35185.66.251.34[root@consul01 ~]#

Page 27: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

PDNS recursor

/etc/pdns-recursor/recursor.conf

packetcache-ttl=0

/etc/pdns-recursor/conf.d/forward-zones.conf

forward-zones=martyshka=consul01:8600;

Page 28: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

Resolver (all nodes)

/etc/resolv.conf

search openprovider.nl hosting-concepts.nl nameserver <recursor 1 IP>nameserver <recursor 2 IP>nameserver <provider NS 1 IP>nameserver <provider NS 2 IP>nameserver 8.8.8.8

Page 29: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

DNS

Consul clusterNotify Admin!

Retrieve services IPs

Page 30: How we cooked Elasticsearch, Consul, HAproxy and DNS-recursor

● Cloud● Cluster

● Fail-over● Redundancy

● Fault tolerance

“fashionable stylish for youth”