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.
You must first install Docker on each cluster node and then configure Docker Swarm and an overlay network.
pssh
command to install Docker on all the hosts in the
cluster.
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"
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"
pssh -i -h hostlist -l user1 -x "-i ~/user1.pem" "sudo useradd dockeruser"