【大數據系列】hadoop單節點安裝官方文檔翻譯

Hadoop: Setting up a Single Node Cluster.

HADOOP:建立單節點集群

  • Purpose
  • Prerequisites
    • Supported Platforms
    • Required Software
    • Installing Software
  • Download
  • Prepare to Start the Hadoop Cluster
  • Standalone Operation
  • Pseudo-Distributed Operation
    • Configuration
    • Setup passphraseless ssh
    • Execution
    • YARN on a Single Node
  • Fully-Distributed Operation

目的

前置條件

? ? 支持的平臺

? ? 需要的軟件

? ?安裝軟件

下載

準備開始建立hadoop集群

單機操作

偽分布式操作

? ?配置

? 設置ssh免密登陸

? 擴展

? 單節點中YARN

完全分布式

Purpose

This document describes how to set up and configure a single-node Hadoop installation so that you can quickly perform simple operations using Hadoop MapReduce and the Hadoop Distributed File System (HDFS).

目的

該文檔描述了如何安裝和配置一個單節點的Hadoop,以便于你可以快速的使用MapReduce和HDFS執行簡單的操作。

Prerequisites

前置條件

Supported Platforms

  • GNU/Linux is supported as a development and production platform. Hadoop has been demonstrated on GNU/Linux clusters with 2000 nodes.

  • Windows is also a supported platform but the followings steps are for Linux only. To set up Hadoop on Windows, see?wiki page.

支持的平臺

? ? ?開發和生產環境支持GUN/linux環境。Hadoop在GUN/LINUX平臺下證實可以創建2000個節點。

? ? ?windows平臺也是支持的,但是如下的操作只是針對linux平臺的,在windows上安裝hadoop,請參考?wiki page.

Required Software

Required software for Linux include:

  1. Java? must be installed. Recommended Java versions are described at?HadoopJavaVersions.

  2. ssh must be installed and sshd must be running to use the Hadoop scripts that manage remote Hadoop daemons if the optional start and stop scripts are to be used. Additionally, it is recommmended that pdsh also be installed for better ssh resource management.

需要的軟件

? ? Java是必須的,需求的Java版本請查看HadoopJavaVersions.

? ?ssh是必須的,sshd必須使用hadoop腳本運行,如果使用開啟或關閉腳本來管理遠程機器上的hadoop進程。此外,為了更好的管理ssh資源pdsh也是需要安裝的。

Installing Software

If your cluster doesn’t have the requisite software you will need to install it.

For example on Ubuntu Linux:

  $ sudo apt-get install ssh$ sudo apt-get install pdsh

安裝軟件

如果你的集群沒有必要的軟件,你需要去安裝它。

例如在Ubuntu linux系統上:

? ?sudo apt-get install ssh

? sudo apt-get install pdsh

Download

To get a Hadoop distribution, download a recent stable release from one of the?Apache Download Mirrors.

下載:

為了獲取hadoop發行版,從Apache Download Mirrors.下載一個最近的穩定的發行版

Prepare to Start the Hadoop Cluster

Unpack the downloaded Hadoop distribution. In the distribution, edit the file?etc/hadoop/hadoop-env.sh?to define some parameters as follows:

  # set to the root of your Java installationexport JAVA_HOME=/usr/java/latest

Try the following command:

  $ bin/hadoop

This will display the usage documentation for the hadoop script.

Now you are ready to start your Hadoop cluster in one of the three supported modes:

  • Local (Standalone) Mode
  • Pseudo-Distributed Mode
  • Fully-Distributed Mode

準備去啟動hadoop集群

解壓下載的hadoop發行版,在解壓文件中,編輯etc/hadoop/hadoop-env.sh去設置如下的參數:

# set to the root of your Java installationexport JAVA_HOME=/usr/java/latest
執行如下命令
$bin/hadoop
這將會展現使用hadoop腳本的文檔現在你可以準備去啟動你的hadoop集群從以下3種模式之一
本地模式
偽分布式
完全分布式

Standalone Operation

By default, Hadoop is configured to run in a non-distributed mode, as a single Java process. This is useful for debugging.

The following example copies the unpacked conf directory to use as input and then finds and displays every match of the given regular expression. Output is written to the given output directory.

  $ mkdir input$ cp etc/hadoop/*.xml input$ bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.0.0-alpha4.jar grep input output 'dfs[a-z.]+'$ cat output/*

單機操作模式
默認情況下,hadoop是設置為非分布式模式,作為一個單獨的Java進程。這對于調試是有用的。以下的例子復制解壓的配置文件并且符合給定的表達式的文件作為輸入。輸出是被寫到給定的輸出文件夾。
$ mkdir input$ cp etc/hadoop/*.xml input$ bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.0.0-alpha4.jar grep input output 'dfs[a-z.]+'$ cat output/*

Pseudo-Distributed Operation

Hadoop can also be run on a single-node in a pseudo-distributed mode where each Hadoop daemon runs in a separate Java process.

偽分布式

hadoop同樣可以運行為單節點的偽分布式模式,在這種情況下每一個hadoop進程作為一個單獨的Java進程單獨運行。

Configuration

Use the following:

etc/hadoop/core-site.xml:

<configuration><property><name>fs.defaultFS</name><value>hdfs://localhost:9000</value></property>
</configuration>

etc/hadoop/hdfs-site.xml:

<configuration><property><name>dfs.replication</name><value>1</value></property>
</configuration>
配置如下

etc/hadoop/core-site.xml:

<configuration><property><name>fs.defaultFS</name><value>hdfs://localhost:9000</value></property>
</configuration>

etc/hadoop/hdfs-site.xml:

<configuration><property><name>dfs.replication</name><value>1</value></property>
</configuration>

Setup passphraseless ssh

Now check that you can ssh to the localhost without a passphrase:

  $ ssh localhost

If you cannot ssh to localhost without a passphrase, execute the following commands:

  $ ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys$ chmod 0600 ~/.ssh/authorized_keys

設置免密登陸

現在檢查你可以不使用密碼ssh到本地

? ?$ ssh localhost?

如果你不可以沒有密碼ssh到本地,執行如下命令:

? $ ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa

? $ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

?$ chmod 0600 ~/.ssh/authorized_keys

Execution

The following instructions are to run a MapReduce job locally. If you want to execute a job on YARN, see?YARN on Single Node.

  1. Format the filesystem:

      $ bin/hdfs namenode -format
    
  2. Start NameNode daemon and DataNode daemon:

      $ sbin/start-dfs.sh
    

    The hadoop daemon log output is written to the?$HADOOP_LOG_DIR?directory (defaults to?$HADOOP_HOME/logs).

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

    • NameNode -?http://localhost:9870/
  4. Make the HDFS directories required to execute MapReduce jobs:

      $ bin/hdfs dfs -mkdir /user$ bin/hdfs dfs -mkdir /user/<username>
    
  5. Copy the input files into the distributed filesystem:

      $ bin/hdfs dfs -mkdir input$ bin/hdfs dfs -put etc/hadoop/*.xml input
    
  6. Run some of the examples provided:

      $ bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.0.0-alpha4.jar grep input output 'dfs[a-z.]+'
    
  7. Examine the output files: Copy the output files from the distributed filesystem to the local filesystem and examine them:

      $ bin/hdfs dfs -get output output$ cat output/*
    

    or

    View the output files on the distributed filesystem:

      $ bin/hdfs dfs -cat output/*
    
  8. When you’re done, stop the daemons with:

      $ sbin/stop-dfs.sh
    

執行

以下的指導描述了如何在本地運行一個MapReduce任務,如果你希望在YARN上執行MapReduce任務請參考后面

1、格式化文件系統

bin/hdfs ?namenode -format

2、啟動NameNode和DataNode

sbin/start-dfs.sh

hadoop進程日志的輸出文件夾由HADOOP_LOG_DIR設置

3、瀏覽NameNode的web頁面,默認是

NameNode http://localhost:9870

4、創建執行MapReduce任務的目錄

$ bin/hdfs dfs -mkdir /user
$ bin/hdfs dfs -mkdir /user/<username>

5、拷貝輸入文件到文件系統

$ bin/hdfs dfs -mkdir input
$ bin/hdfs dfs -put etc/hadoop/*.xml input

6、運行提供的一些例子

? $ bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.0.0-alpha4.jar grep input output 'dfs[a-z.]+'

7、檢查輸出文件:從分布式文件系統中拷貝輸出文件到本地并且檢查他們

$ bin/hdfs dfs -get output output
$ cat output/*
或者

在分布式系統中查看輸出文件:

$ bin/hdfs dfs -cat output/*

8、做完之后,關閉hadoop進程

$ sbin/stop-dfs.sh

YARN on a Single Node

You can run a MapReduce job on YARN in a pseudo-distributed mode by setting a few parameters and running ResourceManager daemon and NodeManager daemon in addition.

The following instructions assume that 1. ~ 4. steps of?the above instructions?are already executed.

  1. Configure parameters as follows:

    etc/hadoop/mapred-site.xml:

    <configuration><property><name>mapreduce.framework.name</name><value>yarn</value></property>
    </configuration>
    

    etc/hadoop/yarn-site.xml:

    <configuration><property><name>yarn.nodemanager.aux-services</name><value>mapreduce_shuffle</value></property><property><name>yarn.nodemanager.env-whitelist</name><value>JAVA_HOME,HADOOP_COMMON_HOME,HADOOP_HDFS_HOME,HADOOP_CONF_DIR,CLASSPATH_PREPEND_DISTCACHE,HADOOP_YARN_HOME,HADOOP_MAPRED_HOME</value></property>
    </configuration>
    
  2. Start ResourceManager daemon and NodeManager daemon:

      $ sbin/start-yarn.sh
    
  3. Browse the web interface for the ResourceManager; by default it is available at:

    • ResourceManager -?http://localhost:8088/
  4. Run a MapReduce job.

  5. When you’re done, stop the daemons with:

      $ sbin/stop-yarn.sh
YARN上運行單節點
你可以通過在偽分布式系統中配置一些參數在YARN上運行一個MapReduce job,除此之外還可以運行ResourceManager和NodeManager
如下的操作假設1~4步已經執行執行

配置參數如下:

etc/hadoop/mapred-site.xml:

<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
etc/hadoop/yarn-site.xml:

<configuration>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.nodemanager.env-whitelist</name>
<value>JAVA_HOME,HADOOP_COMMON_HOME,HADOOP_HDFS_HOME,HADOOP_CONF_DIR,CLASSPATH_PREPEND_DISTCACHE,HADOOP_YARN_HOME,HADOOP_MAPRED_HOME</value>
</property>
</configuration>

啟動ResourceManager進程和NodeManager進程:

$ sbin/start-yarn.sh

瀏覽ResourceManager的web界面,默認認識http://localhost:8088/
ResourceManager - http://localhost:8088/

運行一個MapReduce job

完成之后,停止進程

$ sbin/stop-yarn.sh

?

轉載于:https://www.cnblogs.com/dream-to-pku/p/7298423.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/455456.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/455456.shtml
英文地址,請注明出處:http://en.pswp.cn/news/455456.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

qmlcanvas繪制3d圖形_透視Matplotlib核心功能和工具包 - 繪制3D圖形

關聯知識MatplotlibPython線圖在此&#xff0c;我們將學習如何創建3D線圖。 它類似于2D等效折線圖&#xff0c;并且2D折線圖的許多屬性都結轉到3D。我們將在相同的軸上繪制凹凸曲線&#xff0c;并從不同角度查看它們&#xff0c;例如平行視圖&#xff0c;頂視圖以及圍繞z軸的旋…

264 解碼之 yuv

博客訪問量日漸減少&#xff0c;于是我決定丟一點技術東東上去&#xff0c;吸引爬蟲光顧一下。先談談 h.264 的編解碼問題。個人建議做視頻、音頻的孩子們&#xff0c;一定要抓住 RFC 和 standard &#xff0c;然后多看開源編解碼程序。近來抽空看了兩個 decoder &#xff0c;一…

Java筆記12-函數式接口

主要內容 自定義函數式接口函數式編程常用函數式接口 第一章 函數式接口 概念 函數式接口在java中指的是:有且只有一個抽象方法的接口 函數式接口,即適用于函數式編程場景的接口.而java中共的函數式編程體現就是Lambda,所以函數式接口就是可以適用于lambda使用的接口.只有…

雷軍曬3億估值,意欲“收編”臺灣硬件創業者?

1月13日&#xff0c;在臺灣的CSMIC 2015移動互聯網兩岸年會上&#xff0c;雷軍以獵豹移動董事長的身份做了《給年輕創業者的兩大方向性建議》演講。 演講中雷軍表示&#xff0c;“在未來5到10年&#xff0c;特別適合臺灣年輕創業者做的兩個方向&#xff0c;一個是移動互聯網&am…

網頁“console”輸出圖文信息

http://www.monmonkey.com/javascript/jiben2.html 參考以上鏈接中的轉義字符使用。 http://www.cnblogs.com/Wayou/p/chrome_dev_tool_style_console.html https://segmentfault.com/a/1190000002511877 以上鏈接里有各種 console 輸出 ASCII圖文的實現方法。 ASCII圖文動態效…

記事本安卓軟件代碼設計_用輕量級工具 Notepad3 替代 36 歲的微軟記事本

一不小心&#xff0c;微軟記事本發布 36 年了。雖然微軟記事本自 1985 年 Windows 1.0 以來已包含在所有版本的 Microsoft Windows 中&#xff0c;但它太基礎了&#xff0c;以至于幾乎所有人都要替代它&#xff0c;比如輕量級的 Notepad3&#xff0c;支持代碼高亮/折疊、括號匹…

H.264編碼技術

H.264基本概況隨著HDTV的興起&#xff0c;H.264這個規范頻頻出現在我們眼前&#xff0c;HD-DVD和藍光DVD均計劃采用這一標準進行節目制作。而且自2005年下半年以來&#xff0c;無論是NVIDIA還是ATI都把支持H.264硬件解碼加速作為自己最值得夸耀的視頻技術。H.264到底是何方“神…

Java筆記13-兄弟連在線考試系統

今天內容&#xff1a; 1.兄弟連在線考試系統 1.1 軟件開發的流程 需求分析文檔 > 概要設計文檔 > 詳細設計文檔 > 編碼和測試1.2 編寫目的 (1)復習JavaSE所學的所有內容。 (2)鍛煉基本的編程能力。 1.3 功能分析 考試系統&#xff1a;(1)學員系統a.修改密碼b.開始…

macOS自帶Python2.7刪除之后的悲劇

2019獨角獸企業重金招聘Python工程師標準>>> 起因 今天打開xcode想要開始繼續寫項目的時候悲劇了. Loading a plug-in failed. The plug-in or one of its prerequisite plug-ins may be missing or damaged and may need to be reinstalled. 嘗試用終端打開看看報…

EasyUI 表格點擊右鍵添加或刷新 綁定右鍵菜單

例1 在HTML頁面中設置一個隱藏的菜單&#xff08;前提是已經使用封裝的Easyui&#xff09; 代碼&#xff1a; <div id"contextMenu_jygl" class"easyui-menu" style"width: 80px; display: none;"> <div …

python神奇的小海龜_Python筆記_第一篇_面向過程_第一部分_8.畫圖工具(小海龜turtle)...

turtle 是一個簡單的繪圖工具。提供一個小海龜&#xff0c;可以把它理解為一個機器人&#xff0c;只能聽懂有限的命令&#xff0c;且繪圖窗口的原點(0,0)在中間&#xff0c;默認海龜的方向是右側海龜的命令包括三類&#xff1a;運動命令、筆畫控制命令、其他命令。1. 運動命令…

jupyter淺析

一、jupyter 起步:簡介 Jupyter Notebook是一個開源的Web應用程序&#xff0c;允許用戶創建和共享包含代碼、方程式、可視化和文本的文檔。它的用途包括&#xff1a;數據清理和轉換、數值模擬、統計建模、數據可視化、機器學習等等。它具有以下優勢&#xff1a; 可選擇語言&a…

我在全球最大的同性社交平臺那點事

本文作者&#xff1a;夏之冰雪&#xff0c;i春秋簽約作家 《我在百度網盤上看到上萬條車主個人信息,企業、政府高官信息、各種數據庫和無窮無盡的盜版》&#xff0c;一時間&#xff0c;這篇文章就火了&#xff0c;火爆程度另百度猝不及防。 其實呢&#xff0c;這事真不能全怪百…

H.264的CAVLC(編碼.解碼)過程詳解

看264也看到CAVLC來了&#xff0c;把這方面的資料貼在這里&#xff1a; 編碼過程&#xff1a; 假設有一個4*4數據塊 &#xff08;變化&#xff0c;量化后就送入熵編碼&#xff09;{ 0 , 3 , -1 , 0, 0, -1 , 1, 0, 1 , 0 , 0 , 0, 0 , 0 , 0 , 0 } 數據重排列&a…

python進程通信方式有幾種_python全棧開發基礎【第二十一篇】互斥鎖以及進程之間的三種通信方式(IPC)以及生產者個消費者模型...

一、互斥鎖進程之間數據隔離&#xff0c;但是共享一套文件系統&#xff0c;因而可以通過文件來實現進程直接的通信&#xff0c;但問題是必須自己加鎖處理。注意&#xff1a;加鎖的目的是為了保證多個進程修改同一塊數據時&#xff0c;同一時間只能有一個修改&#xff0c;即串行…

Python實現修改圖片尺寸

起步 很多小伙伴從網上找的圖片可能圖片尺寸與自己的需求不符合 今天小編就教大家使用python寫一個簡單腳本程序實現修改圖片的尺寸 環境準備 首先我們需要python環境,它的安裝可以參考:python安裝以及版本檢測 其次我們還需要安裝一個python圖形化的庫PIL PIL的安裝,這里…

數據集

https://zhuanlan.zhihu.com/p/25138563轉載于:https://www.cnblogs.com/zhangbojiangfeng/p/7039725.html

常見的攻擊手段及其防御方式

本文簡單介紹幾種常見的攻擊手段及其防御方式 XSS(跨站腳本攻擊)CSRF&#xff08;跨站請求偽造&#xff09;SQL注入DDOSXSS 概念 全稱是跨站腳本攻擊&#xff08;Cross Site Scripting&#xff09;&#xff0c;指攻擊者在網頁中嵌入惡意腳本程序。案列 比如說我寫了一個博客網站…

使用ffmpeg進行h.264編碼

m_fmt->video_codec CODEC_ID_H264; /* 添加視頻流 */ m_video_st av_new_stream(m_oc, 0); if (!m_video_st) { return 0; } m_videocavcodec_alloc_context(); m_videoc m_video_st->codec; /* 視頻相關參數 */ m_videoc->codec_id m_fmt->video_codec; m_…

關于java的關鍵字 transient

我們都知道一個對象只要實現了Serilizable接口&#xff0c;這個對象就可以被序列化&#xff0c;Java的這種序列化模式為開發者提供了很多便利&#xff0c;我們可以不必關系具體序列化的過程&#xff0c;只要這個類實現了Serilizable接口&#xff0c;這個的所有屬性和方法都會自…