目录
名称 | ip |
docker | 192.168.204.136 |
1:拉镜像
docker pull registry.cn-hangzhou.aliyuncs.com/hadoop_test/hadoop_base
2.创建容器
三个容器的名称分别是Master、Slave1、Slave2
1.创建hadoop内部网络
docker network create --driver=bridge hadoop
2.创建master容器,开放端口
docker run -it --network hadoop -h Master --name Master -p 9870:9870 -p 8088:8088 registry.cn-hangzhou.aliyuncs.com/hadoop_test/hadoop_base bash
3.创建slave1容器,不开放端口
docker run -it --network hadoop -h Slave1 --name Slave1 registry.cn-hangzhou.aliyuncs.com/hadoop_test/hadoop_base bash
4.创建slave2容器,不开放端口
docker run -it --network hadoop -h Slave2 --name Slave2 registry.cn-hangzhou.aliyuncs.com/hadoop_test/hadoop_base bash
3.三台主机都修改/etc/hosts文件必须重启一下
vim /etc/hosts
172.20.0.2 Master
172.20.0.3 Slave1
172.20.0.4 Slave2
4.格式化hdfs
cd /usr/local/hadoop/bin
./hadoop namenode -format
5.启动hadoop
cd /usr/local/hadoop/sbin
./start-all.sh
6.访问web页面
docker:8088 docker:9870