Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Docker — How to Get Started With Cloudera

DZone's Guide to

Docker — How to Get Started With Cloudera

This article offers information and code/scripts which could be used to get started with Cloudera using Docker. Read on to learn more.

· Cloud Zone
Free Resource

MongoDB Atlas is a database as a service that makes it easy to deploy, manage, and scale MongoDB. So you can focus on innovation, not operations. Brought to you in partnership with MongoDB.


This article offers information and code/scripts which could be used to get started with Cloudera using Docker. Please feel free to comment/suggest if I fail to mention one or more important points.


The following are the key points described in this article:


  • Docker machine configuration
  • Cloudera & Docker
  • Test the Cloudera installation
  • Scripts to install & run Cloudera


Docker Machine Configuration


To run Cloudera in a Docker container, one is required to make the following configuration to the Docker machine. Open Oracle VM Virtualbox Manager. Stop the default machine. Then, change the settings as shown below.


  • Change the processor (core) setting to 2

Image title

Increase core size to 2

  • Change the memory setting to 8192 (8 GB Ram)

Image title

Increase Memory Size to 8GB    


If not done, running “cloudera-manager –express” throws following error:

Image title

Memory related error while starting Cloudera manager service


Cloudera & Docker


  • As of date, Cloudera docker image is of size 4.4 GB. Mind you this is going to take some time for image to build.
  • For installation of Cloudera image, you could adopt following three methods:
    • Use command such as following:
      docker pull cloudera/quickstart:latest        
    • Use Docker file with following content:
      FROM cloudera/quickstart:latest        
      Save the file as cloudera.df and then, use following command to build the image:
      docker build -t cloudera -f cloudera.df .        
      The image is tagged as Cloudera.
    • Download the Cloudera quickstart tar file. Untar it and import it in Docker. The following command could be used:
      tar xzf cloudera-quickstart-vm-*-docker.tar.gz
      docker import - cloudera/quickstart:latest < cloudera-quickstart-vm-*-docker/*.tar          
  • Once the Cloudera image is built, the following command could be used to run the container:
    docker run --privileged=true -ti -d -p 8888:8888 -p 80:80 -p 7180:7180 --name $1 --hostname=quickstart.cloudera -v /c/Users:/mnt/Users $cd_image /usr/bin/docker-quickstart     
    Note that image is named/tagged as Cloudera. You could as well check “docker images” command to find the tag name of Cloudera image and use it in place of “cloudera”. Also, note the port such as 7180, 8888 mapped from guest to host.


Test the Cloudera Installation


Execute the following command to start the Cloudera service assuming that you started the container with the name as “cdh”. Use the scripts below to start “cdh” cloudera container.


docker exec -ti cdh /home/cloudera/cloudera-manager --express


With the above command, Cloudera starts as shown below:

Image title

Cloudera starts in a Docker container


Open a browser and access the following command: http://192.168.99.100:7180/. It will open up the login page for Cloudera Manager. Enter the login/password as cloudera/cloudera and you are all set!


Scripts to install & run Cloudera


The following is the script which could be used to install/build the image and run the cloudera container.


  • cloudera.df. This is dockerfile for building Cloudera image
    FROM cloudera/quickstart:latest     
  • runCloudera.sh. This is a script to build the Cloudera image (if not present) and start the container.
    #!/bin/sh
    
    if [ $# == 0 ]; then
      echo "This script expect container name argument. Example: ./runCloudera.sh cdh"
      exit 100
    fi
    
    docker stop $1;docker rm $1
    
    # Build Cloudera image if it does not exists
    #
    cd_image="cloudera"
    cd_df="cloudera.df"
    if [ `docker images $cd_image | wc -l` -lt 2 ]; then
      echo "Docker Image $cd_image do not exist..."
      echo "Builing docker image $cd_image"
      if [ -f $cd_df ]; then
        docker build -t $cd_image -f $cd_df .
      else
        echo "Can't find Dockerfile $cd_df in the current location"
        exit 200
      fi
    fi
    
    docker run --privileged=true -ti -d -p 8888:8888 -p 80:80 -p 7180:7180 --name $1 --hostname=quickstart.cloudera -v /c/Users:/mnt/Users $cd_image /usr/bin/docker-quickstart      


Open a Docker terminal, place both the files within a folder and execute the command such as “./runCLoudera.sh cdh”. This should build the image and start the container named “cdh”.

MongoDB Atlas is the best way to run MongoDB on AWS — highly secure by default, highly available, and fully elastic. Get started free. Brought to you in partnership with MongoDB.

Topics:
cloudera ,cloud ,docker

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}