docker为hadoop的云化带来了极大便利,安装和应用也会更快更方便.进入正题:
docker search hadoop
将会看到如下结果:
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATEDdocker.io docker.io/sequenceiq/hadoop-docker An easy way to try Hadoop 301 [OK]docker.io docker.io/sequenceiq/hadoop-ubuntu An easy way to try Hadoop on Ubuntu 31 [OK]docker.io docker.io/ruo91/hadoop Apache hadoop 2.x - Pseudo-Distributed Mode 11 [OK]docker.io docker.io/uhopper/hadoop Base Hadoop image with dynamic configurati... 6 [OK]docker.io docker.io/gelog/hadoop WORK IN PROGRESS. NOT PRODUCTION READY 4 [OK]docker.io docker.io/uhopper/hadoop-resourcemanager Hadoop resourcemanager 3 [OK]docker.io docker.io/dockmob/hadoop Docker images for Apache Hadoop (YARN, HDF... 2 [OK]docker.io docker.io/lewuathe/hadoop-master Multiple node hadoop cluster on Docker. 2 [OK]docker.io docker.io/uhopper/hadoop-datanode Hadoop datanode 2 [OK]docker.io docker.io/uhopper/hadoop-namenode Hadoop namenode 2 [OK]docker.io docker.io/uhopper/hadoop-nodemanager Hadoop nodemanager 2 [OK]docker.io docker.io/falkonry/hadoop Docker config for hadoop image 1 [OK]docker.io docker.io/ading1977/hadoop Docker image for multi-node hadoop cluster. 0 [OK]
我们当然选择星最多的.选择第一个:
docker pull sequenceiq/hadoop-docker
然后等待下载.
下载完毕之后启动docker镜像:
docker run -it --name hadoop sequenceiq/hadoop-docker /etc/bootstrap.sh -bash
测试运行:
cd $HADOOP_PREFIX# run the mapreducebin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.0.jar grep input output 'dfs[a-z.]+'# check the outputbin/hdfs dfs -cat output/*
我下载的时候最新的还是这个2.7版本.后来的小伙伴也不一定是2.7呦.可以进入share目录去看一下提供的测试jar包是什么版本然后运行,然后查看输出结果