forked from kiwenlau/hadoop-cluster-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart-container.sh
executable file
·39 lines (33 loc) · 1.07 KB
/
start-container.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# the default node number is 5
N=${1:-6}
# start hadoop master container
sudo docker rm -f hadoop-master &> /dev/null
echo "start hadoop-master container..."
sudo docker run -itd \
--net=hadoop \
-p 50070:50070 \
-p 9000:9000 \
-v /data/hdfs/namenode:/root/hdfs/namenode \
--name hadoop-master \
--hostname hadoop-master \
reg.querycap.com/cloudchain/hadoop:1.1
# start hadoop slave container
i=1
while [ $i -lt $N ]
do
PORT=$((50010 + $i))
sudo docker rm -f hadoop-slave$i &> /dev/null
echo "start hadoop-slave$i container..."
sudo docker run -itd \
--net=hadoop \
-v /data/hdfs/datanode$i:/root/hdfs/datanode \
-v $PWD/datanode/hdfs-site-$i.xml:/usr/local/hadoop/etc/hadoop/hdfs-site.xml \
-p $PORT:$PORT \
--name hadoop-slave$i \
--hostname hadoop-slave$i \
reg.querycap.com/cloudchain/hadoop:1.1
i=$(( $i + 1 ))
done
# get into hadoop master container
sudo docker exec -it hadoop-master bash