1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| docker pull centos:6.10
docker run -tid centos:6.10
docker ps
docker exec -ti <id> /bin/bash
docker stop <id>
docker start <id>
docker rm <id>
|
1 2 3 4 5
|
docker run -ti -v /c/Users/dell/workspace/docker/share:/root/share --name hadoop centos:6.10
|
1 2 3 4 5 6
| docker network create --subnet=172.18.0.0/16 hadoop-net docker run -ti --net hadoop-net --ip 172.18.0.2 hadoop-distributed-base
docker commit a6d06a446754 hadoop-distributed-base
|
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
| docker run -it --name hadoop-master \ --net hadoop-net \ --ip 172.18.0.2 \ --add-host node1:172.18.0.3 \ --add-host node2:172.18.0.4 \ --add-host node3:172.18.0.5 \ -p 9820:9820 \ -p 9870:9870 \ -p 9868:9868 \ -p 8088:8088 \ -p 19888:19888 \ -v /c/Users/dell/workspace/docker/share:/root/share \ -h master hadoop-distributed-base
docker run -it --name hadoop-node1 \ --net hadoop-net \ --ip 172.18.0.3 \ --add-host master:172.18.0.2 \ -p 9864 \ -v /c/Users/dell/workspace/docker/share:/root/share \ -h node1 hadoop-distributed-base
docker run -it --name hadoop-node2 \ --net hadoop-net \ --ip 172.18.0.4 \ --add-host master:172.18.0.2 \ -p 9864 \ -v /c/Users/dell/workspace/docker/share:/root/share \ -h node2 hadoop-distributed-base
docker run -it --name hadoop-node3 \ --net hadoop-net \ --ip 172.18.0.5 \ --add-host master:172.18.0.2 \ -p 9864 \ -v /c/Users/dell/workspace/docker/share:/root/share \ -h node3 hadoop-distributed-base
|
1 2 3
| service sshd start bin/hdfs namenode -format <cluster_name> $HADOOP_HOME/sbin/start-dfs.sh
|
访问 webui 在windows上面其实是docker是运行在虚拟机环境中的。所以不能直接 通过 http://127.0.0.1:9870 来访问。
需要访问虚拟机IP。虚拟机IP在启动 docker 容器的时候会有显示。
http://192.168.99.100:9870
1 2 3 4 5 6
| hdfs dfs -mkdir -p /user/root/input
hdfs dfs -rm -R output
hdfs dfs -cat output/*
|
$. Reference
- OpenStack Installation Guide
- OpenStack组件生态