Sunday 14 August 2016

Docker 1.12 and Crate

I've been very busy at work recently.... Seattle for DockerCon, San Francisco to meet with partners/clients and then New York to give a presentation to a meetup group hosted by Packet. Not to mention the stuff I've been working on back here in Berlin. One of the things I have been working on, when I have a spare moment, is updating my knowledge on Docker since the release of Docker Engine 1.12. Of course, Crate.io is producing official documentation. Before that comes out, however, here is what I have been playing with.

Docker Engine 1.12

The latest Docker Engine in pretty sweet; it brings together a lot of functionality that previously resided in different tools, notably:

In the screencast above you can see how easily I manage to create a Docker Swarm and then run Crate within that Swarm. I suspect that there is an even easier method for creating the Swarm ('docker-machine create' has multiple --swarm options) that I have yet to explore fully. Certainly Docker Machine does not seem to be as fully-featured as, say, Vagrant. But for many common and simple use cases, it wins hands-down with simplicity. The real magic comes in the form of Docker Swarm. If you have not watched that screencast already, do it now. Look how simple it is to setup the orchestration! That is seriously awesome. One of the things I love about Crate is "simplicity as a feature" and the same is true of Docker Swarm.

Sadly, Crate does not actually work in the manner shown in the screencast. Actually, it does not work at all with Docker Engine 1.12 and we should maybe talk a little about that. So let's do that.

Crate and the Docker Overlay Network

In theory there are some awesome features of Docker Engine 1.12 that make it perfectly suited for use with Crate:

  • Built-in load balancing for services with published ports. This allows you to connect to any published IP:port on any of the Swarm members and get access to the relevant service (even if it is not running on that Swarm member). Incoming connections are round-robin'd. This great for Crate and its masterless architecture. Since you can connect to any Crate node, you might as well spread the love around.
  • Global mode deployment is great for Crate. In Docker Swarm you can either have replica-count-based deployment ("Give me 5 replicas of this container, please.") or you can do "global" deployment ("Give me one running container on each Swarm member"). This is great for Crate, because typically you only want one container on each host (because you will always max-out the CPU on certain activities, like bulk insert). This is also great for scaling your cluster. Simply add a new Swarm member and watch as the new node joins your Crate cluster.

But it's not all good news...

Towards the end of my screencast you will see me Create an overlay network, allowing the Crate nodes to communicate with each other. Sadly, this network does not properly support multicast. You can find a issue for this here. So the service you see me run at the end of the screencast cannot work. Instead, I'm supposed to pass the '-Des.discovery.zen.ping.unicast.hosts' parameter to the service creation. Thankfully, Docker's service discovery mechanism built into 1.12 makes our life easy. By simply using the name of the service, we cn get something that is resolved to a meaningful IP that will allow nodes to talk to each other.

docker service create \
--name crate \
--network crate \
--mode global \
--publish 4200:4200/tcp \
--publish 4300:4300/tcp \
crate:latest \
crate \
-Des.discovery.zen.ping.multicast.enabled=false \
-Des.discovery.zen.ping.unicast.hosts=crate

OK, so no multicast, but this solution is easy enough. Right?

Well, it would be if it worked. For some reason, at this point, the Crate nodes are unable to communicate with each other. This appears to be a known issue to Elasticsearch users and appeared in rc4 (according to this forum post). It really would be great to see a swift fix for this.

To Conclude...

Overall, Docker Engine 1.12 is a great concept: bringing together a lot of tools under one roof. I particularly love how simple it is to get things going, compared with, say, Apache Mesos. Sadly for us Crate users, it is not quite there yet. Who knows how long it will take to get

With native support now available for all platforms, you really have run out of excuses not to give it a try.

No comments:

Post a Comment