17
Deploying Elasticsearch on Docker with Weave Ilya Dmitrichenko @weaveworks

Deploying Elasticsearch on Docker with Weave

Embed Size (px)

Citation preview

Page 1: Deploying Elasticsearch on Docker with Weave

Deploying Elasticsearch on Docker with Weave

Ilya Dmitrichenko @weaveworks

Page 2: Deploying Elasticsearch on Docker with Weave

Docker is great!

• Highly portable delivery framework

• Fuelling CI/CD/DevOps with

• tight and transparent dependency packaging

• good isolation, without virtualisation overhead

• easy to setup, manage and automate

Page 3: Deploying Elasticsearch on Docker with Weave

Ok, I want Docker!• I surely want to use Docker for next-gen

microservices architecture, it looks just right.

• I also see many other great tools  that are related, e.g.:

• Kubernetes/Mesos/Marathon/Swarm

• Terraform/Brooklyn/fleet/Machine

• etcd/Consul/Zookeeper

• OK, may be I should start with something basic

Page 4: Deploying Elasticsearch on Docker with Weave

Can I run Elasticsearch on Docker out-of-the-box?

• Yes, there is an official image:

> docker run -d elasticsearch

Page 5: Deploying Elasticsearch on Docker with Weave

…and what about clustering?

• I don’t see how to do it with the official image, but there seems to be another one by @itgz

> docker run -d \

-p 9200:9200 -p 9300:9300 itzg/elasticsearch

> docker run -d \

-p 9200:9201 -p 9300:9301 itzg/elasticsearch

> docker run -d \

-p 9200:9202 -p 9300:9302 itzg/elasticsearch

• That’s not “official”, right?

Page 6: Deploying Elasticsearch on Docker with Weave

I am still not sure how clustering will work ;’(

• What are `-p 9200:9201 -p 9300:9301`?

• How do I run the instances on different hosts?

• Which port should my client use?

• What is the “ambassador patter”?

• May be I need a kind of orchestrator tool?

Page 7: Deploying Elasticsearch on Docker with Weave

I found a few examples of what others did…

• Mesos + HAProxy + Marathon + Ansible

• This one uses Ubuntu in EC2 and I really should be using RedHat in Azure, I am also not sure about switching to Ansible from Puppet, and still need to learn more about all the Mesos stuff…

• CoreOS + fleet + etcd

• I like the idea of CoreOS, but not sure if my boss likes it and, it still looks a bit complicated…

• Kubernetes

• Looks also interesting, but I am not sure we can introduce Kubernetes either… I just want to demo proof-of-concept next week

Page 8: Deploying Elasticsearch on Docker with Weave

Introducing Weave

• Easiest way to build portable Docker app clusters

• You won't have to change your app

• Lean service discovery which doesn't in your way

• Simple to use on its own or with an orchestrator

Page 9: Deploying Elasticsearch on Docker with Weave

Install Weavesudo curl -L git.io/weave \ -o /usr/local/bin/weave

sudo chmod +x /usr/local/bin/weave

weave launch \ -iprange <CIDR> \ <PEERS>

weave launch-dns <CIDR>

Page 10: Deploying Elasticsearch on Docker with Weave

Run Containers

weave run --with-dns \ —h myapp.weave.local \ [docker_args] \ <docker_image> \ [app_args]

Page 11: Deploying Elasticsearch on Docker with Weave

WeaveDNS rocks!

> curl es-1.weave.local:9200/_cat/nodes es-1.weave.local 10.2.3.1 4 18 0.50 d * Shuma-Gorath es-3.weave.local 10.2.3.192 4 17 0.04 d m Frankie and Victoria es-2.weave.local 10.2.3.128 3 17 0.02 d m Lady Jacqueline Falsworth Crichton

Page 12: Deploying Elasticsearch on Docker with Weave

WeaveDNS rocks!

var es = new elasticsearch.Client({ hosts: [ 'es-1.weave.local:9200' , 'es-2.weave.local:9200' , 'es-3.weave.local:9200' ] });

Page 13: Deploying Elasticsearch on Docker with Weave

Demo

Let's go!

Based on previous blog post: http://blog.weave.works/2015/01/20/elasticsearch-and-weave/

Page 14: Deploying Elasticsearch on Docker with Weave

Other benefits

• No host port mapping or NAT

• Encryption on network layer

• Multiple ES clusters on same hosts

• Cross-datacenter connectivity

• Multicast works anywhere

Page 15: Deploying Elasticsearch on Docker with Weave

New features

• distributed IP address allocator (out today)

• native Docker plugin

• fast in-kernel data path

Page 16: Deploying Elasticsearch on Docker with Weave

Container visibility

• Weave Scope automatically generates a map of your containers, enabling you to intuitively understand, monitor, and control your applications.

• weave.works/scope

Page 17: Deploying Elasticsearch on Docker with Weave

Questions?