Managing Data Operating System
Also available as:
PDF
loading table of contents...

Configure Docker Swarm and an Overlay Network

You must first install Docker on each cluster node and then configure Docker Swarm and an overlay network.

Maintain a host list file that specifies every host in the cluster and a worker list file that specifies all the nodes except the one selected to be the Docker Swarm master. You can use this information to run commands in parallel across the cluster.
  1. Use the pssh command to install Docker on all the hosts in the cluster.
    The following example shows the required commands:
    pssh -i -h hostlist -l user1 -x "-i ~/user1.pem" "sudo yum install -y yum-utils device-mapper-persistent-data lvm2"
    pssh -i -h hostlist -l user1 -x "-i ~/user1.pem" "sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo"
    pssh -i -h hostlist -l user1 -x "-i ~/user1.pem" "sudo yum install -y docker-ce"
    pssh -i -h hostlist -l user1 -x "-i ~/user1.pem" "sudo systemctl start docker"
    pssh -i -h hostlist -l user1 -x "-i ~/user1.pem" "sudo systemctl enable docker"
    pssh -i -h hostlist -l user1 -x "-i ~/user1.pem" "sudo docker run --rm hello-world"
  2. Configure Docker Swarm and create an overlay network.
    The following example shows the required commands:
    ssh -i ~/user1.pem user1@<masternode> "sudo docker swarm init"
    pssh -i -h workerlist -l user1 -x "-i ~/user1.pem" "sudo <output from last command: docker swarm join ...>"
    ssh -i ~/user1.pem user1@<masternode> "sudo docker network create -d overlay --attachable yarnnetwork"
  3. Optional: If Kerberos is not enabled, create a default user for containers.
    The following example shows how you can create a default user:
    pssh -i -h hostlist -l user1 -x "-i ~/user1.pem" "sudo useradd dockeruser"
Configure Docker settings for YARN using Ambari.