forked from kiwenlau/hadoop-cluster-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resize hadoop cluster size dynamically
- Loading branch information
Showing
3 changed files
with
44 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
master.kiwenlau.com | ||
slave1.kiwenlau.com | ||
slave2.kiwenlau.com | ||
slave3.kiwenlau.com | ||
slave4.kiwenlau.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
tag="0.1.0" | ||
|
||
# N is the node number of the cluster | ||
N=$1 | ||
|
||
if [ $# = 0 ] | ||
then | ||
echo "Please use the node number of the cluster as the argument!" | ||
exit 1 | ||
fi | ||
|
||
cd hadoop-master | ||
|
||
# change the slaves file | ||
echo "master.kiwenlau.com" > files/slaves | ||
i=1 | ||
while [ $i -lt $N ] | ||
do | ||
echo "slave$i.kiwenlau.com" >> files/slaves | ||
((i++)) | ||
done | ||
|
||
# delete master container | ||
sudo docker rm -f master | ||
|
||
# delete hadoop-master image | ||
sudo docker rmi kiwenlau/hadoop-master:$tag | ||
|
||
# rebuild hadoop-master image | ||
pwd | ||
sudo docker build -t kiwenlau/hadoop-master:$tag . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters