Need docker be installed and configured to use Device Mapper diver first
https://docs.docker.com/engine/userguide/storagedriver/device-mapper-driver/
Device Mapper driver is used to limit each container storge size, if you just want to try this repo, you can comment these lines in start-container.sh:
--storage-opt size=10G
sudo docker pull wentaoma/hadoop:2.7.2
git clone https://github.com/WalterMa/hadoop-cluster-docker.git
sudo docker network create --driver=bridge hadoop
cd hadoop-cluster-docker
sudo ./start-container.sh
output:
start hadoop-master container...
start hadoop-slave1 container...
start hadoop-slave2 container...
start hadoop-slave3 container...
start hadoop-slave4 container...
root@hadoop-master:~#
- start 3 containers with 1 master and 4 slaves
- you will get into the /root directory of hadoop-master container
./start-hadoop.sh
- start hadoop services include httpfs
./run-wordcount.sh
output
input file1.txt:
Hello Hadoop
input file2.txt:
Hello Docker
wordcount output:
Docker 1
Hadoop 1
Hello 2
do 1~3 like section A
sudo ./resize-cluster.sh 3
- specify parameter > 1: 2, 3..
- this script just rebuild hadoop image with different slaves file, which pecifies the name of all slave nodes
sudo ./start-container.sh 3
- use the same parameter as the step 2
do 5~6 like section A
Please see this repo: https://github.com/WalterMa/hadoop-intellj-example