天天看點

BigData之Hadoop:Hadoop的簡介、深入了解、下載下傳、案例應用之詳細攻略(二)

1、Hadoop的三大特性——可靠、高效、可伸縮

       Hadoop是一個能夠對大量資料進行分布式處理的軟體架構。 Hadoop 以一種可靠、高效、可伸縮的方式進行資料處理 。

Hadoop 是可靠的,因為它假設計算元素和存儲會失敗,是以它維護多個工作資料副本,確定能夠針對失敗的節點重新分布處理。

Hadoop 是高效的,因為它以并行的方式工作,通過并行處理加快處理速度。

Hadoop 是可伸縮的,能夠處理 PB 級資料。

2、Hadoop的五大優點——高可靠性、高擴充性、高效性、高容錯性、低成本

       Hadoop是一個能夠讓使用者輕松架構和使用的分布式計算平台。使用者可以輕松地在Hadoop上開發和運作處理海量資料的應用程式。它主要有以下幾個優點:

1.高可靠性。Hadoop按位存儲和處理資料的能力值得人們信賴。

2.高擴充性。Hadoop是在可用的計算機集簇間配置設定資料并完成計算任務的,這些集簇可以友善地擴充到數以千計的節點中。

3.高效性。Hadoop能夠在節點之間動态地移動資料,并保證各個節點的動态平衡,是以處理速度非常快 。

4.高容錯性。Hadoop能夠自動儲存資料的多個副本,并且能夠自動将失敗的任務重新配置設定。

5.低成本。Hadoop 依賴于社群服務,是以它的成本比較低,任何人都可以使用 。與一體機、商用資料倉庫以及QlikView、Yonghong Z-Suite等資料集市相比,hadoop是開源的,項目的軟體成本是以會大大降低 。

       Hadoop帶有用Java語言編寫的架構,是以運作在 Linux 生産平台上是非常理想的。Hadoop 上的應用程式也可以使用其他語言編寫,比如 C++。

3、Hadoop大資料處理的意義——得益于資料提取、變形和加載的天然優勢

        Hadoop得以在大資料處理應用中廣泛應用得益于其自身在資料提取、變形和加載(ETL)方面上的天然優勢。Hadoop的分布式架構,将大資料處理引擎盡可能的靠近存儲,對例如像ETL這樣的批處理操作相對合适,因為類似這樣操作的批處理結果可以直接走向存儲。Hadoop的MapReduce功能實作了将單個任務打碎,并将碎片任務(Map)發送到多個節點上,之後再以單個資料集的形式加載(Reduce)到資料倉庫裡。

Hadoop的下載下傳

官網位址:

https://hadoop.apache.org/releases.html

       為了友善起見,Hadoop作為源代碼tarball釋出,并帶有相應的二進制tarball。下載下傳通過鏡像站點分發,應該使用GPG或SHA-512檢查是否有篡改。

Version Release date Source download Binary download Release notes

3.3.0 2020 Jul 14 source (checksum signature) binary (checksum signature)

binary-aarch64 (checksum signature) Announcement

2.10.0 2019 Oct 29 source (checksum signature) binary (checksum signature) Announcement

3.1.3 2019 Oct 21 source (checksum signature) binary (checksum signature) Announcement

3.2.1 2019 Sep 22 source (checksum signature) binary (checksum signature) Announcement

2.9.2 2018 Nov 19 source (checksum signature) binary (checksum signature) Announcement

To verify Hadoop releases using GPG:

Download the release hadoop-X.Y.Z-src.tar.gz from a mirror site.

Download the signature file hadoop-X.Y.Z-src.tar.gz.asc from Apache.

Download the Hadoop KEYS file.

gpg –import KEYS

gpg –verify hadoop-X.Y.Z-src.tar.gz.asc

To perform a quick check using SHA-512:

Download the checksum hadoop-X.Y.Z-src.tar.gz.sha512 or hadoop-X.Y.Z-src.tar.gz.mds from Apache.

shasum -a 512 hadoop-X.Y.Z-src.tar.gz

Hadoop的案例應用

1、Hadoop:設定單節點叢集

源自:

https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-common/SingleCluster.html

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

Download

To get a Hadoop distribution, download a recent stable release from one of the 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 installation

 export 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

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.2.1.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.

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:

       <name>dfs.replication</name>

       <value>1</value>