Fork me on GitHub

从零开始,在Docker环境部署Hadoop

虚拟机环境:CentOS 7.0


1、安装docker


Docker官方的安装脚本

curl -sSL https://get.docker.com/ | sh

因为网络原因总是安装失败,后来改用国内的源镜像安装



阿里云的安装脚本

 

curl -sSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/internet | sh -


 


2、镜像加速器

还是网络原因,从Docker Hub获取镜像遇到困难,我这里采用了DaoCloud加速器:https://www.daocloud.io/


3、获取镜像

1、获取centos基础镜像

 

docker pull centos

 

2、获取Hadoop镜像

这里采用了kiwenlau/hadoop版本的hadoop镜像

 

    docker pull kiwenlau/hadoop:1.0
3、下载Github仓库

 

    git clone https://github.com/kiwenlau/hadoop-cluster-docker

 

4、创建docker网络

 

    docker network create --driver=bridge hadoop

 

5、运行Docker容器

 

    cd hadoop-cluster-docker
    ./start-container.sh

 

启动了3个容器,1个master, 2个slave
运行后就进入了hadoop-master容器的/root目录

6、启动hadoop

 

./start-hadoop.sh
7、运行wordcount

 

./run-wordcount.sh

 


-------

参考:

[1]、https://yeasy.gitbooks.io/docker_practice/content/install/centos.html
[2]、http://kiwenlau.com/2016/06/12/160612-hadoop-cluster-docker-update/

 

posted @ 2017-02-08 09:23  夏天海岸线  阅读(296)  评论(0编辑  收藏  举报