021 单节点集群上 Ubuntu 安装 Hadoop 3.X

021 Installation of Hadoop 3.x on Ubuntu on Single Node Cluster

1. Objective

1. 目标

In this tutorial on Installation of Hadoop 3.x on Ubuntu, we are going to learn steps for setting up a pseudo-distributed, single-node Hadoop 3.x cluster on Ubuntu. We will learn steps like how to install java, how to install SSH and configure passwordless SSH, how to download Hadoop, how to setup Hadoop configurations like .bashrc file, hadoop-env.sh, core-site.xml, hdfs-site.xml, mapred-site.xml, YARN-site.xml, how to start the Hadoop cluster and how to stop the Hadoop services.

在本教程中,安装Hadoop3. 个 Ubuntu 的,我们要学习步骤建立伪分布式,单-Hadoop 3. 个集群节点在 Ubuntu.我们将学习如何安装 java 、如何安装 SSH 和配置无密码 SSH 、如何下载 Hadoop 、如何设置 Hadoop 配置等步骤.如何启动 Hadoop 集群以及如何停止 Hadoop 服务,bashrc 文件、 hadoop-env.sh 、 core-site.xml 、 hdfs-site.xml 、 mapred-site.xml 、 YARN-site.xml.

Learn step by step installation of Hadoop 2.7.x on Ubuntu.

在 Ubuntu 上了解 Hadoop 2.7.X 的分步安装.

Installation of Hadoop 3.x on Ubuntu on Single Node Cluster

2. Installation of Hadoop 3.x on Ubuntu

Hadoop 2. 安装 Ubuntu 的 3.x

Before we start with Hadoop 3.x installation on Ubuntu, let us understand key features that have been added in Hadoop 3 that makes the comparison between Hadoop 2 and Hadoop 3.

在我们开始在 Ubuntu 上安装 Hadoop 3.X 之前,让我们了解 Hadoop 3 中添加的关键功能,这些功能使得Hadoop 2 和 3. 的比较.

2.1. Java 8 installation

2.1.安装 Java 8

Hadoop requires working java installation. Let us start with steps for installing java 8:

Hadoop 需要安装 java.让我们从安装 java 8 的步骤开始:

a. Install Python Software Properties

A.安装 Python 软件属性

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">sudo apt-get install python-software-properties</pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">安装 python-软件-属性</pre>

b. Add Repository

B.添加存储库

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">sudo add-apt-repository ppa:webupd8team/java</pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Sudo add-apt-repository ppa: webupd8team/java</pre>

c. Update the source list

C.更新源列表

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">sudo apt-get update</pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Sudo apt-获取更新</pre>

d. Install Java 8

安装 Java 8

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">sudo apt-get install oracle-java8-installer</pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Sudo apt-get 安装 oracle-java8-installer</pre>

e. Check if java is correctly installed

检查 java 是否安装正确

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">java -version</pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Java 版本</pre>

2.2. Configure SSH

2.2.配置 SSH

SSH is used for remote login. SSH is required in Hadoop to manage its nodes, i.e. remote machines and local machine if you want to use Hadoop on it. Let us now see SSH installation of Hadoop 3.x on Ubuntu:

远程登录使用 SSH.Hadoop 中需要 SSH 来管理其节点,即如果要在其上使用 Hadoop,则需要远程机器和本地机器.现在让我们在 Ubuntu 上看到 Hadoop 3.X 的 SSH 安装:

a. Installation of passwordless SSH

答: 无密码 SSH 的安装

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">sudo apt-get install ssh
sudo apt-get install pdsh</pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">安装 ssh sudo apt
Sudo apt-获取安装 pdsh</pre>

b. Generate Key Pairs

生成密钥对

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa</pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Ssh-密钥生成-t rsa-P '-f ~/.ssh/id _ rsa</pre>

c. Configure passwordless ssh

配置无密码 ssh

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">cat /.ssh/id_rsa.pub>>/.ssh/authorized_keys</pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Ssh/id _ rsa.Pub>>/.ssh/授权 _ 密钥</pre>

e. Change the permission of file that contains the key

E.更改包含密钥的文件的权限

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">chmod 0600 ~/.ssh/authorized_keys</pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Chmod 0600 ~/.ssh/授权 _ 密钥</pre>

f. ****check ssh to the localhost

F.****检查本地主机的 ssh

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ssh localhost</pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Ssh 本地主机</pre>

2.3. Install Hadoop

2.3.安装 Hadoop

a. Download Hadoop

A.下载 Hadoop

http://redrockdigimark.com/apachemirror/hadoop/common/hadoop-3.0.0-alpha2/hadoop-3.0.0-alpha2.tar.gz

(Download the latest version of Hadoop hadoop-3.0.0-alpha2.tar.gz)

(下载最新版 Hadoop hadoop-3.0.0-alpha2.tar.gz)

b. Untar Tarball

Untar Tarball

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">tar -xzf hadoop-3.0.0-alpha2.tar.gz</pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Tar-xzf hadoop-3.0.0-alpha2.tar.gz</pre>

2.4. Hadoop Setup Configuration

2.4.Hadoop 设置配置

a. Edit .Bashrc
Open .bashrc

A.编辑.Bashrc
打开.Bashrc

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">nano ~/.bashrc</pre>

Edit .bashrc:

编辑.Bashrc:

Edit .bashrc file is located in user’s home directory and adds following parameters:

编辑.Bashrc 文件位于用户的主目录中,并添加了以下参数:

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">export HADOOP_PREFIX="/home/dataflair/hadoop-3.0.0-alpha2"
export PATH=PATH:HADOOP_PREFIX/bin
export PATH=PATH:HADOOP_PREFIX/sbin
export HADOOP_MAPRED_HOME={HADOOP_PREFIX} export HADOOP_COMMON_HOME={HADOOP_PREFIX}
export HADOOP_HDFS_HOME={HADOOP_PREFIX} export YARN_HOME={HADOOP_PREFIX}</pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">导出 hadoop _ 前缀 = "/home/dataflair/hadoop-3.0.0-alpha2"
导出路径 = PATH: hadoop _ 前缀/bin
导出路径 = PATH: HADOOP_PREFIX/sbin
出口 HADOOP_MAPRED_HOME ={ HADOOP_PREFIX} 出口 HADOOP_COMMON_HOME ={ HADOOP_PREFIX}
出口 HADOOP_HDFS_HOME ={ HADOOP_PREFIX} 出口 YARN_HOME ={ HADOOP_PREFIX}</pre>

Then run

然后跑

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Source ~/.bashrc</pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">源 ~/.bashrc</pre>

b. Edit hadoop-env.sh

编辑 hadoop-env.sh

Edit configuration file hadoop-env.sh (located in HADOOP_HOME/etc/hadoop) and set JAVA_HOME:

编辑配置文件 hadoop-env.sh (位于 hadoop _ home/etc/hadoop 中) 并设置 java _ home:

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">export JAVA_HOME=/usr/lib/jvm/java-8-oracle/</pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">导出 java _ home =/usr/lib/jvm/java-8-oracle/</pre>

c. Edit core-site.xml

编辑 core-site.xml

Edit configuration file core-site.xml (located in HADOOP_HOME/etc/hadoop) and add following entries:

编辑配置文件 core-site.xml (位于 hadoop _ home/etc/hadoop 中) 并添加以下条目:

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/home/dataflair/hdata</value>
</property>
</configuration></pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><配置>
<物业>
<Name> fs.defaultFS </name>
Local://本地主机: 9000 </value>
</物业>
<物业>
<Name> hadoop.tmp.dir </name>
<Value>/home/dataflair/hdata </value>
</物业>
</配置></pre>

d. ****Edit hdfs-site.xml

D.****编辑 hdfs-site.xml

Edit configuration file hdfs-site.xml (located in HADOOP_HOME/etc/hadoop) and add following entries:

编辑配置文件 hdfs-site.xml (位于 hadoop _ home/etc/hadoop 中) 并添加以下条目:

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration></pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><配置>
<物业>
Dfs.复制 </name>
<值> 1 </值>
</物业>
</配置></pre>

e. Edit mapred-site.xml

E.编辑 mapred-site.xml

If mapred-site.xml file is not available, then use

如果 mapred-site.xml 文件不可用,则使用

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">cp mapred-site.xml.template mapred-site.xml</pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Mapred-site.xml.template cp mapred-site.xml</pre>

Edit configuration file mapred-site.xml (located in HADOOP_HOME/etc/hadoop) and add following entries:

编辑配置文件 mapred-site.xml (位于 hadoop _ home/etc/hadoop 中) 并添加以下条目:

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration></pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><配置>
<物业>
<Name> mapreduce.framework.name </name>
纱线 </value>
</物业>
</配置></pre>

f. Yarn-site.xml

F.Yarn-site.xml

Edit configuration file mapred-site.xml (located in HADOOP_HOME/etc/hadoop) and add following entries:

编辑配置文件 mapred-site.xml (位于 hadoop _ home/etc/hadoop 中) 并添加以下条目:

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><configuration>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
</property>
</configuration></pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><配置>
<物业>
Aux.nodemanager.aux-服务 </name>
<<价值> mapreduce_shuffle/超值>
</物业>
<物业>
Yarn.nodemanager.Aux-services.mapreduce.shuffle.class </name>
<Value> org.apache.hadoop.mapred.ShuffleHandler </value>
</物业>
</配置></pre>

Test your Hadoop knowledge with this Big data Hadoop quiz.

测试你的 Hadoop 知识Hadoop 大数据问答.

2.5. How to Start the Hadoop services

2.5.Hadoop 服务怎么启动:

Let us now see how to start the Hadoop cluster:

现在让我们来看看如何启动 Hadoop 集群:

The first step to starting up your Hadoop installation is formatting the Hadoop filesystem which is implemented on top of the local filesystem of your “cluster”. This is done as follows:

启动 Hadoop 安装的第一步是格式化 Hadoop 文件系统,该文件系统是在 “集群” 的本地文件系统之上实现的.具体做法如下:

a. Format the namenode

A. 格式名称节点

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">bin/hdfs namenode -format</pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Bin/hdfs 名称节点格式</pre>

NOTE: This activity should be done once when you install Hadoop and not for running Hadoop filesystem, else it will delete all your data from HDFS

注意: 当你安装 Hadoop 而不是运行 Hadoop 文件系统时,这个活动应该完成一次,否则它会从 HDFS 中删除你所有的数据

b. ****Start HDFS Services

B.****启动 HDFS 服务

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">sbin/start-dfs.sh</pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">/Sbin/start-dfs.sh</pre>

It will give an error at the time of start HDFS services then use:

它会在开始时出错HDFS然后使用服务:

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">echo "ssh" | sudo tee /etc/pdsh/rcmd_default</pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Echo “ssh” | sudo tee/etc/pdsh/rcmd _ default</pre>

c. Start YARN Services

开始纱线服务

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">sbin/start-yarn.sh</pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">/Sbin/start-yarn.sh</pre>

d. ****Check how many daemons are running

D.****检查运行了多少守护进程

Let us now see whether expected Hadoop processes are running or not:

现在让我们看看预期的 Hadoop 进程是否正在运行:

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">jps
2961 ResourceManager
2482 DataNode
3077 NodeManager
2366 NameNode
2686 SecondaryNameNode
3199 Jps</pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Jps
2961 资源管理器
2482 DataNode
3077 节点管理器
2366 南德
2686 秒
3199 Jps</pre>

Learn How to install Cloudera Hadoop CDH5 on ubuntu from this installation guide.

了解如何在 ubuntu 上安装 Cloudera Hadoop CDH5此安装指南.

2.6. How to Stop the Hadoop services

2.6.Hadoop 服务怎么停止:

Let us learn how to stop Hadoop services now:

现在让我们来了解一下如何停止 Hadoop 服务:

a. Stop YARN services

停止纱线服务

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">sbin/stop-yarn.sh</pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">/Sbin/stop-yarn.sh</pre>

b. ****Stop HDFS services

B.****停止 HDFS 服务

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">sbin/stop-dfs.sh</pre>

<pre class="EnlighterJSRAW" data-enlighter-language="null" style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">/Sbin/stop-dfs.sh</pre>

Note:

注:

Browse the web interface for the NameNode; by default, it is available at:

浏览 NameNode 的 web 界面; 默认情况下,它在以下位置可用:

NameNode – http://localhost:9870/

Http://本地主机: 9870/

Browse the web interface for the ResourceManager; by default, it is available at:

浏览资源管理器的 web 界面; 默认情况下,它在以下位置可用:

ResourceManager – http://localhost:8088/

//本地主机: 8088/

Run a MapReduce job

运行 MapReduce 作业

We are all ready to start our first Hadoop MapReduce job through Hadoop word count example.

我们已经准备好开始我们的第一个 HadoopMapReduce通过 Hadoop 字数统计示例进行作业.

Learn MapReduce job optimization and performance tuning techniques.

学习MapReduce 作业优化与性能调优技术.

Also see:

另见:

Reference

参考

https://data-flair.training/blogs/installation-of-hadoop-3-x-on-ubuntu

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 218,525评论 6 507
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 93,203评论 3 395
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 164,862评论 0 354
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,728评论 1 294
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,743评论 6 392
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,590评论 1 305
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,330评论 3 418
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,244评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,693评论 1 314
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,885评论 3 336
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 40,001评论 1 348
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,723评论 5 346
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,343评论 3 330
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,919评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 33,042评论 1 270
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,191评论 3 370
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,955评论 2 355

推荐阅读更多精彩内容

  • 一、系统参数配置优化 1、系统内核参数优化配置 修改文件/etc/sysctl.conf,添加如下配置,然后执行s...
    张伟科阅读 3,754评论 0 14
  • 环境 一台ubuntu 14.04虚拟机。 Hadoop版本:2.6.0。 增加用户 为了隔离Hadoop和其它软...
    doc001阅读 1,825评论 1 9
  • 服务器环境:Ubuntu15.04、jdk1.7、Hadoop2.7.1 1. 创建spark用户#### 为了隔...
    TyiMan阅读 1,143评论 0 3
  • 我一直觉得自己写作文采不太好,但近些天来,我却迷上了写诗。我把自己的所感、所悟都写入了诗里,细细品之,感到...
    张志岳阅读 636评论 5 3
  • 我是一个自卑的人,说话、做事情的时候,总是太在意别人的眼光。 我是一个自卑的人,不敢和领导轻松自由的聊天。...
    夏玫小墨阅读 550评论 3 1