资源准备:jdk1.8及hadoop2.7.3

链接:https://pan.baidu.com/s/1x8t1t2iY46jKkvNUBHZlGQ
提取码:g1gm
复制这段内容后打开百度网盘手机App,操作更方便哦

1、下载Ubuntu镜像

docker pull ubuntu:14.04

2、运行Ubuntu安装环境

#启动ubuntu容器
docker run -ti ubuntu

3、ubuntu安装基础环境

  安装ssh、vim等常用工具

4、ubuntu安装jdk环境

linux系统安装jdk环境

5、ubuntu hadoop配置

#解压hadoop文件
tar xvzf hadoop-2.7..tar.gz 修改~/.bashrc文件。在文件末尾加入下面配置信息: export JAVA_HOME=/usr/lib/jvm/java--oracle
export HADOOP_HOME=/root/soft/apache/hadoop/hadoop-2.7.
export HADOOP_CONFIG_HOME=$HADOOP_HOME/etc/hadoop
export PATH=$PATH:$HADOOP_HOME/bin
export PATH=$PATH:$HADOOP_HOME/sbin

这里创建了三个目录,后续配置的时候会用到:

  1. tmp:作为Hadoop的临时目录
  2. namenode:作为NameNode的存放目录
  3. datanode:作为DataNode的存放目录

  1).core-site.xml配置

  

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
--> <!-- Put site-specific property overrides in this file. --> <configuration>
<property>
<name>hadoop.tmp.dir</name>
<value>/root/soft/apache/hadoop/hadoop-2.7.3/tmp</value>
<description>A base for other temporary directories.</description>
</property> <property>
<name>fs.default.name</name>
<value>hdfs://master:9000</value>
<final>true</final>
<description>The name of the default file system. A URI whose
scheme and authority determine the FileSystem implementation. The
uri's scheme determines the config property (fs.SCHEME.impl) naming
the FileSystem implementation class. The uri's authority is used to
determine the host, port, etc. for a filesystem.</description>
</property>
</configuration>

注意:

  • hadoop.tmp.dir配置项值即为此前命令中创建的临时目录路径。
  • fs.default.name配置为hdfs://master:9000,指向的是一个Master节点的主机(后续我们做集群配置的时候,自然会配置这个节点,先写在这里)

  2).hdfs-site.xml配置

  使用命令nano hdfs-site.xml编辑hdfs-site.xml文件:

  

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
--> <!-- Put site-specific property overrides in this file. --> <configuration>
<property>
<name>dfs.replication</name>
<value>2</value>
<final>true</final>
<description>Default block replication.
The actual number of replications can be specified when the file is created.
The default is used if replication is not specified in create time.
</description>
</property> <property>
<name>dfs.namenode.name.dir</name>
<value>/root/soft/apache/hadoop/hadoop-2.7.3/namenode</value>
<final>true</final>
</property> <property>
<name>dfs.datanode.data.dir</name>
<value>/root/soft/apache/hadoop/hadoop-2.7.3/datanode</value>
<final>true</final>
</property>
</configuration>

注意:

  • 我们后续搭建集群环境时,将配置一个Master节点和两个Slave节点。所以dfs.replication配置为2。
  • dfs.namenode.name.dirdfs.datanode.data.dir分别配置为之前创建的NameNode和DataNode的目录路径

  3).mapred-site.xml配置

  Hadoop安装文件中提供了一个mapred-site.xml.template,所以我们之前使用了命令cp mapred-site.xml.template mapred-site.xml,创建了一个mapred-site.xml文件。

  下面使用命令nano mapred-site.xml编辑这个文件:

  

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
--> <!-- Put site-specific property overrides in this file. --> <configuration>
<property>
<name>mapred.job.tracker</name>
<value>master:9001</value>
<description>The host and port that the MapReduce job tracker runs
at. If "local", then jobs are run in-process as a single map
and reduce task.
</description>
</property>
</configuration>

这里只有一个配置项mapred.job.tracker,我们指向master节点机器。

  4)修改JAVA_HOME环境变量

  hadoop-env.sh、mapred-env.sh、yarn-env.sh添加jdk环境配置,修改如下配置:

# The java implementation to use.
export JAVA_HOME=/soft/jdk-8u161

  5)格式化 namenode

  这是很重要的一步,执行命令hadoop namenode -format

6、hadoop集群启动

Docker 安装Hadoop集群的更多相关文章

  1. docker安装hadoop集群

    docker安装hadoop集群?图啥呢?不图啥,就是图好玩.本篇博客主要是来教大家如何搭建一个docker的hadoop集群.不要问 为什么我要做这么无聊的事情,答案你也许知道,因为没有女票.... ...

  2. Docker部署Hadoop集群

    Docker部署Hadoop集群 2016-09-27 杜亦舒 前几天写了文章"Hadoop 集群搭建"之后,一个朋友留言说希望介绍下如何使用Docker部署,这个建议很好,Doc ...

  3. 使用Docker搭建Hadoop集群(伪分布式与完全分布式)

    之前用虚拟机搭建Hadoop集群(包括伪分布式和完全分布式:Hadoop之伪分布式安装),但是这样太消耗资源了,自学了Docker也来操练一把,用Docker来构建Hadoop集群,这里搭建的Hado ...

  4. 使用docker构建hadoop集群

    docker的使用越来越普遍了,大家不知道docker的还需要进一步学习一下.这次咱们使用docker去进行hadoop集群的构建. 使用docker构建的好处真的很多,一台电脑上可以学习安装很多想做 ...

  5. 安装Hadoop集群的最快的软件

    Quick Hadoop是一款安装Hadoop集群的桌面软件,只需要点两下鼠标,一分钟之内安装Hadoop到集群上,超快! 还在每台主机的Shell里一行一行地敲安装Hadoop的命令?别苦逼了! 用 ...

  6. CentOS7 搭建Ambari-Server,安装Hadoop集群(一)

    2017-07-05:修正几处拼写错误,之前没发现,抱歉! 第一次在cnblogs上发表文章,效果肯定不会好,希望各位多包涵. 编写这个文档的背景是月中的时候,部门老大希望我们能够抽时间学习一下Had ...

  7. 通过ambari安装hadoop集群,ZT

    通过ambari安装hadoop集群,ZT http://www.cnblogs.com/cenyuhai/p/3295635.html http://www.cnblogs.com/cenyuhai ...

  8. Linux上安装Hadoop集群(CentOS7+hadoop-2.8.0)--------hadoop环境的搭建

    Linux上安装Hadoop集群(CentOS7+hadoop-2.8.0)------https://blog.csdn.net/pucao_cug/article/details/71698903 ...

  9. 安装hadoop集群--hdfs

    安装hadoop集群--hdfs 大数据软件 链接:https://pan.baidu.com/s/1-3PYLHMgvvONawJq55hstQ 提取码:izqf 准备一台干净的虚拟机-centos ...

随机推荐

  1. 【转】Spring事务介绍

    1. 事务的特性:ACID 原子性(Atomicity):事务是一个原子操作,由一系列动作组成.事务的原子性确保动作要么全部完成,要么完全不起作用. 一致性(Consistency):一旦事务完成(不 ...

  2. Hadoop之HDFS(三)HDFS的JAVA API操作

    HDFS的JAVA API操作 HDFS 在生产应用中主要是客户端的开发,其核心步骤是从 HDFS 提供的 api中构造一个 HDFS 的访问客户端对象,然后通过该客户端对象操作(增删改查)HDFS ...

  3. Docker学习笔记_初装的Centos无ifconfig

    新创建了centos容器,使用ifconfig,报无此命令. 解决办法,使用yum进行安装ifconfig 1.yum search ifconfig 2.yum install net-tools. ...

  4. 各种RNAseq原理

    RNA Sequencing Methods Low-Level RNA Detection CEL-Seq CirSeq CLaP CytoSeq Digital RNA Sequencing DP ...

  5. codefirst 关系处理

    1.http://www.cnblogs.com/libingql/archive/2013/01/31/2888201.html 2.多对多 protected override void OnMo ...

  6. 转:Linux awk 命令 说明

    一.  AWK 说明 awk是一种编程语言,用于在linux/unix下对文本和数据进行处理.数据可以来自标准输入.一个或多个文件,或其它命令的输出.它支持用户自定义函数和动态正则表达式等先进功能,是 ...

  7. [docker]本地仓库的创建的使用

    如果自己创建的镜像可以供其他同事使用,那就可以大大节约开发时间成本,docker的本地仓库正好可以满足这样的需求 1.在仓库服务器上创建本地仓库 baylor@baylor-virtual-machi ...

  8. Python基础入门-while循环示例

    闲来无事! 想写一些基础的东西! 比如今天的while循环,,,,,, 很多python初学者,最开始学习python的时候,会被while循环给干蒙蔽! 那么今天,小编为大家讲解一些基础的实例,来帮 ...

  9. HDU 4803 Poor Warehouse Keeper(贪心)

    题目链接 题意 :屏幕可以显示两个值,一个是数量x,一个是总价y.有两种操作,一种是加一次总价,变成x,1+y:一种是加一个数量,这要的话总价也会相应加上一个的价钱,变成x+1,y+y/x.总价显示的 ...

  10. vmware10中arch使用遇到的一些问题

    xfce4中安装中文输入法fcitx step 1  #pacman -S fcitx-im setp 2 在~/.xinitrc中添加如下内容: export LC_ALL=zh_CN.UTF-8e ...