Multi-Node Clusters With Cloudera Quickstart for Docker
We have a look at the steps to easily create a multi-node cluster with Cloudera and Docker.
Join the DZone community and get the full member experience.Join For Free
Last December, we introduced the Cloudera QuickStart Docker image to make it easier than ever before to explore Cloudera's distributed data processing platform, including tools such as Apache Impala (incubating), Apache Spark, and Apache Solr. While the single-node getting-started image was well-received, we noted a large number of requests from the community for a multi-node CDH deployment via Docker. Today, we are excited to announce the new-and-improved Cloudera QuickStart for Docker.
To enable a multi-node cluster deployment on the same Docker host, we created a CDH topology for Apache HBase's
clusterdock framework. As detailed in HBASE-12721,
clusterdock is a simple, Python-based library designed to orchestrate multi-node cluster deployments on a single host. Unlike existing tools like Docker Compose, which are great at managing microservice architectures,
clusterdock orchestrates multiple containers to act more like traditional hosts. In this paradigm, a four-node Apache Hadoop cluster uses four containers. We've found it to be a great tool for testing and prototyping.
To begin, install Docker on your host. Older versions of Docker lack the embedded DNS server and correct reverse hostname lookup required by Cloudera Manager, so ensure you're running Docker 1.11.0 or newer. Also, keep in mind that the host you use to run your CDH cluster must meet the same resource requirements as a normal multi-node deployment. Therefore, we recommend at least 16GB of free RAM for a two-node cluster and at least 24GB of free RAM for a four-node cluster.
For ease-of-use and portability,
clusterdock itself is packaged in a Docker image and its binaries are executed by running containers from this image and specifying an action. This can be done by sourcing the
clusterdock.sh helper script and then calling script of interest with the
clusterdock_run command. As is always a good idea when executing code from the internet, examine the script to convince yourself of its safety, and then run:
source/dev/stdin<<<"$(curl -sL http://tiny.cloudera.com/clusterdock.sh)"
Starting a cluster with
clusterdock takes advantage of an abstraction known as a topology; in short, a basic set of steps needed to coordinate pre-built Docker images into a functioning multi-container cluster. If all you'd like is a two-node cluster (with default options being used for everything else), simply type:
When this is run,
clusterdock will start two containers from images stored on Docker Hub. As they contain a full Cloudera Manager/CDH deployment, downloading the images the first time may take upwards of five minutes, but this is a one-time cost, as the images are then cached locally by Docker. As the cluster starts,
clusterdock manages communication between containers through Docker's bridge networking driver and also updates your host's
/etc/hosts file to make it easier to connect to your container cluster.
Once the cluster is running and the health of your CDH services is validated, you can access the cluster through the Cloudera Manager UI (the address and port number are shown at the end of the startup process). You can also SSH directly to nodes of your cluster using the
clusterdock_ssh function where the first argument is
cdh (the topology being used) and the second is the fully qualified domain name of the node. For example, running...
clusterdock_ssh cdh node-1.cluster
Warning:Permanently added'node-1.cluster,192.168.124.2'(RSA)tothe list of known hosts. Last login:Mon Jul2511:11:362016from192.168.124.1 [root@node-1~]#
clusterdock supports a number of options that can provide for a more interesting testing environment. We provide a few examples in the sections below, but full usage instructions can be seen by including
--help in the invocation of the
cdh topology itself:
Larger Cluster Deployments
If your machine has the available resources,
clusterdock allows you to start n-node sized clusters where one node acts as the CM server (and has the majority of CDH service roles assigned to it) and the remaining n-1 nodes act as secondaries with most CDH slave services assigned to them. As an example, to create a four-node CDH cluster in which the containers are named
In this case, the
clusterdock CDH topology takes advantage of Cloudera Manager's host template functionality to distribute the roles on
node-4. That is, with only two images,
clusterdock allows for arbitrarily-sized cluster deployments. (Again, this is a full cluster running on a single host with a single host’s worth of resources. Be careful!)
Specifying Services to Include (or Exclude)
clusterdock CDH topology allows you to provide a list of the service types to include in your cluster. This functionality uses the
--include-service-types option and removes any service type from Cloudera Manager not included in the list. For example, to create a two-node cluster with only HDFS, Apache ZooKeeper, Apache HBase, and YARN present:
--exclude-service-types option can be used to explicitly leave out services. To create a four-node cluster
machine-4.mycluster) without Impala present:
While the single-node approach was good for learning and ramp up, the new Cloudera QuickStart for Docker is also excellent for test and development. It provides an easy way to prototype new ideas and use cases, as well as try out new functionality and the latest Cloudera releases. (Just remember, it’s not intended nor supported for production use.)
Lastly, we'd love to know what you think. Please post any and all feedback in our Community Forum; we’d like to hear both positive and constructive suggestions for future improvements. Why not take this opportunity to try it out right away?
Published at DZone with permission of Dima Spivak, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.