diff --git a/Dockerfile b/Dockerfile index 5332b3d3..d07f1b55 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,7 @@ RUN wget https://github.com/kiwenlau/compile-hadoop/releases/download/2.7.2/hado # set environment variable ENV JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 ENV HADOOP_HOME=/usr/local/hadoop +ENV HADOOP_CLASSPATH=/usr/lib/jvm/java-7-openjdk-amd64/lib/tools.jar ENV PATH=$PATH:/usr/local/hadoop/bin:/usr/local/hadoop/sbin # ssh without key diff --git a/README.md b/README.md index 1ea382b1..00159f0a 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,13 @@ cd hadoop-cluster-docker sudo ./start-container.sh ``` + +If you want to keep the data from your previous launch + +``` +sudo ./start-container-preserved.sh +``` + **output:** ``` diff --git a/start-container-preserved.sh b/start-container-preserved.sh new file mode 100755 index 00000000..4231aa39 --- /dev/null +++ b/start-container-preserved.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# the default node number is 3 +N=${1:-3} + + +# start hadoop master container +echo "start hadoop-master container..." +sudo docker run -itd \ + --net=hadoop \ + -p 50070:50070 \ + -p 8088:8088 \ + --name hadoop-master \ + --hostname hadoop-master \ + kiwenlau/hadoop:1.0 &> /dev/null + + +# start hadoop slave container +i=1 +while [ $i -lt $N ] +do + echo "start hadoop-slave$i container..." + sudo docker run -itd \ + --net=hadoop \ + --name hadoop-slave$i \ + --hostname hadoop-slave$i \ + kiwenlau/hadoop:1.0 &> /dev/null + i=$(( $i + 1 )) +done + +# get into hadoop master container +sudo docker exec -it hadoop-master bash