SlideShare a Scribd company logo
How to build a Hadoop cluster
with Cloudera
王敏賢 Phate
Introduction
• Apache Hadoop distribution
• Hardware and Network
• Software
Download => http://goo.gl/MH8xS4 2
WHY WE NEED TO KNOW OTHER
DISTRIBUTIONS?
Download => http://goo.gl/MH8xS4 3
Cloudera
• 由Google、Yahoo、Facebook的三位工程師
在2008年時創辦,是第一家以開發Hadoop
為基礎的軟體公司,Intel是其主要投資者。
• Cloudera稱其超過一半的工程產出都捐給
Hadoop相關的專案。
• http://blog.cloudera.com/blog/
Download => http://goo.gl/MH8xS4 4
Others distribution
• MapR
– 底層用C/C++重新改寫
– 閉源
– HBase、Pig、Hive、ZooKeeper由該公司貢獻
• Hortonworks
– 由Yahoo出資的獨立公司,最常被拿來跟
Cloudera做比較。
Download => http://goo.gl/MH8xS4 5
Some Information
• Cloudera vs Hortonworks vs MapR: Comparing
Hadoop Distributions
• Products that include Apache Hadoop or
derivative works and Commercial Support
Download => http://goo.gl/MH8xS4 6
HARDWARE
Download => http://goo.gl/MH8xS4 7
Hardware
• Hadoop是預期運行在量產(commodity)的機
器上,雖然較廉價但並不意謂是低階(low-
end)的產品。
• 首先必須先了解Hadoop節點的各種角色。
Download => http://goo.gl/MH8xS4 8
Hadoop service
• 5個核心服務:
– NameNode(NN)
– SecondaryNameNode(SNN)
– DataNode(DN)
– JobTracker(JT)
– TaskTracker(TT)
• 這五個都是獨立的背景服務。
Technology Master Slave
HDFS NameNode DataNode
MapReduce JobTracker TaskTracker
Download => http://goo.gl/MH8xS4 9
Hadoop service
NameNode
• NN會將HDFS的metadata存放在記憶體中,
包含副本的位置、檔案的屬性(檔名、擁有
者區塊的列表等等)。
• 據經驗每一百萬個區塊就要耗掉約1GB的記
憶體,大概是64TB的資料。
Download => http://goo.gl/MH8xS4 10
Hadoop service
NameNode
• NN主要維護兩個檔案:
– fsimage:對整個檔案系統的快照。
– edits:交易紀錄。
• NN只有在重新啟動時才會將edits寫入
fsimage,其中一個問題是當edits過大時,
下次重新啟動的時間將會被拖慢。
Download => http://goo.gl/MH8xS4 11
Hadoop service
SecondaryNameNode
• SNN名稱常被誤會,他並不是用來解決NN
單點故障的問題,其不具備熱備份的功能。
• 註: 有些文件會將它稱作CheckPoint Node
Download => http://goo.gl/MH8xS4 12
Some Information
• 解读Secondary NameNode的功能
• Hadoop 2.0 NameNode HA和Federation实践
• ECC的重要性?
Download => http://goo.gl/MH8xS4 13
Hardware
Master
• 在叢集中應該將Master分配在較可靠的機器
上,因為當故障時復原的成本是較高的。
• 一般來說Master服務需要較大量的記憶體,
對硬碟的需求是較低的,不過NameNode及
JobTracker會不斷產生Log檔,規劃時須預留
部分空間。
Download => http://goo.gl/MH8xS4 14
Hardware
NameNode
• NameNode對整個Hadoop叢集的重要性不
言而喻。
• RAM-足夠容納metadata的記憶體,甚至需
要ECC功能。
• 硬碟-通常並不需要很大的空間,但需要較
高的可靠性,對於較要求的環境下會用
RAID10備份。
• SNN通常會配置相同的規格。
Download => http://goo.gl/MH8xS4 15
Hardware
JobTracker
• 也需要大量的記憶體,因為為了快速提供
任務的狀態,JobTracker會將過去執行過的
任務保留在記憶體中,這會使的JVM heap
快速成長。
• 因為牽扯到執行的任務狀況,這部分並不
好預測。
Download => http://goo.gl/MH8xS4 16
Hardware
Slave
• 通常不考慮CPU、RAM、硬碟的平衡。
• DataNode:
– 要考慮到的是每個區塊副本的數量,最少應該
要有3份副本,也就是說1TB的資料量應該在叢
集中準備3TB的空間。
– Hadoop的模型剛好符合JBOD的I/O特徵,每顆
硬碟能被OS單獨存取。
• JBOD(Just a bunch of disks)
Download => http://goo.gl/MH8xS4 17
Why you need at least three replicas
C
B A
Download => http://goo.gl/MH8xS4 18
Hardware
Slave
• TaskTracker:
– Hadoop會替每個task產生單獨的JVM,必須考
慮到這部分的負擔。
– 這些節點應該著重在CPU及RAM。
Download => http://goo.gl/MH8xS4 19
Hardware
一些建議規格-CPU
• 目前市面上較流行的CPU(Intel Haswell)都是多核心,
時脈數也都不低,大部份都可以滿足需求。
• 舊零件以Intel CPU來說,則需要考慮到一些問題:
• 目前二手零件較多的LGA775腳位,雖然價格便宜,但
主機板上能擴充的部份有限。
• LGA1156的CPU像i7 800系列,這類主機板不好找,不建
議使用。
• 效能及功耗。
Download => http://goo.gl/MH8xS4 20
Hardware
目前市售CPU
資料來源 : 原價屋 2015/05/26Download => http://goo.gl/MH8xS4 21
More information
about CPU
• CPU BOSS
• [問題] CPU腳位代表什麼?
Download => http://goo.gl/MH8xS4 22
Hardware
一些建議規格-主機板
• 主機板除了須考慮支援的CPU外還需要考慮
擴充的性能,包括支援的RAM、I/O以及是
否有顯示埠。部分規格以Intel為例:
晶片型號 H81 B85 H97 Z97 速度(MB/s)
定位 低階 商務 中階 高階
USB2.0 8 8 8 8 60
USB3.0 2 4 6 6 500
SATA總數 4 6 6 6 300
SATA 6.0GB/s 2 4 6 6 600
資料來源 : Intel 官網產品比較
Download => http://goo.gl/MH8xS4 23
Hardware
一些建議規格-RAM
• 每家廠商生產的主機板各個型號支援程度
都有差,必須自行查看規格,要注意如下
項目:
– 插槽數量
– 最高支援容量
– 速率
• 目前桌上型記憶體大部分都是終身保固,
DDR2新品價格過高,如手邊的機器要添購
的話,二手價差約一半。
Download => http://goo.gl/MH8xS4 24
Hardware
一些建議規格-RAM
• 以ASUS Z97-C為例
Download => http://goo.gl/MH8xS4 25
Hardware
一些建議規格-硬碟
• 目前桌上型電腦常用的3.5吋SATA3 HDD針對
使用需求會有不同的型號,對Slave node來
說可能比較不擔心資料損毀問題,可以選
用較便宜的家用硬碟或效能較好的企業碟。
• SSD配置得宜的話能提升MapReduce 70%的
效能,不過要注意的是SSD的壽命不如HDD。
Download => http://goo.gl/MH8xS4 26
More information
• How-to: Select the Right Hardware for Your
New Hadoop Cluster
• The Truth About MapReduce Performance on
SSDs
Download => http://goo.gl/MH8xS4 27
NETWORK
Download => http://goo.gl/MH8xS4 28
Network
• Hadoop要求節點間至少要用Gigabit Ethernet
連結,必須挑選支援Gigabit的網路設備。
• 家用主機板都有支援到Gigabit。
• 10 Gigabit的網路設備目前價格依然過高。
Download => http://goo.gl/MH8xS4 29
Network architecture
• 必須事先規劃好叢集中每台主機的IP、host
name資訊。
Download => http://goo.gl/MH8xS4 30
Network
Download => http://goo.gl/MH8xS4 31
Network
Download => http://goo.gl/MH8xS4 32
SOFTWARE
Download => http://goo.gl/MH8xS4 33
Software
• 這次架設的軟體版本如下:
– CentOS 6.6
– CDH 5.3(Cloudera’s Cloudera Distribution
Including Apache Hadoop)
– Cloudera Manager 5.3
– JDK 7
– MySQL 5.1
• CDH 5 Requirements and Supported Versions
Download => http://goo.gl/MH8xS4 34
Software
OS
• CDH5支援的OS如下:
– RHEL
– CentOS
– Oracle Linux
– Ubuntu/Debian
Download => http://goo.gl/MH8xS4 35
RHEL&Fedora&CentOS
• Fedora一開始是基於Red Hat Linux來建立,
每個版本裡都會加入許多最新技術。後來
紅帽公司開始贊助Fedora社群,並用Fedora
core取代掉Red Hat Linux,而另外發行Red
Hat Enterprise Linux(RHEL),紅帽公司會在
Fedora中測試新技術以便加入RHEL。
• CentOS是依照RHEL釋出的程式碼編譯而成,
其中不包含閉源軟體。
Download => http://goo.gl/MH8xS4 36
Software
OS
• 目前CentOS最新的版本為7,不過該版本
RPM的MySQL已經被MariaDB取代掉了,而
且MariaDB並未被CDH支援。網路上雖然有
人成功用CentOS7佈署成功,但並不穩定。
• 現在CentOS與RHEL生命週期都是10年,
CentOS6.6預計支援到2020年。
• http://wiki.centos.org/Download
Download => http://goo.gl/MH8xS4 37
BEFORE YOU INSTALL CDH
Download => http://goo.gl/MH8xS4 38
Network config.
• 設定如下兩個檔案:
• 最後service network restart套用設定。
Download => http://goo.gl/MH8xS4 39
SSH key
• 必須要讓Master不用密碼登入Slave操作。
Master
Slave
Public key
SSH
Download => http://goo.gl/MH8xS4 40
SSH key
Download => http://goo.gl/MH8xS4 41
SSH key
Download => http://goo.gl/MH8xS4 42
SSH key
• authorized_keys是可以存放很多把公鑰,可
以用 附加到原
有的檔案中。
• 相關設定參考:
• http://linux.vbird.org/linux_server/0310telnet
ssh.php#ssh_nopasswd
cat ~/.ssh/XXXX.pub >> ~/.ssh/authorized_keys
Download => http://goo.gl/MH8xS4 43
JDK
• CentOS附帶的是OpenJDK,並未被Cloudera
測試過,通常需要替換Oracle JDK。
• How to Install JAVA 7 on CentOS
Download => http://goo.gl/MH8xS4 44
Database
• Cloudera manager需要一個資料庫來儲存記
錄。
# yum install mysql-server
# chkconfig mysql on
# service mysql start
Download => http://goo.gl/MH8xS4 45
Database
• 建立完root帳號以後依照需求建立資料庫實
體。
• Cloudera Manager and Managed Service Data
Stores with MySQL
Download => http://goo.gl/MH8xS4 46
防火牆與SELinux
關閉防火牆
# service iptables stop
# chkconfig iptables off
關閉SELinux
# setenforce 0
修改/etc/selinux/config
SELINUX=disabled
•為了方便安裝過程先
將防火牆關閉,未來
應依需求設定。
Download => http://goo.gl/MH8xS4 47
NTP
• 分散式系統通常都會要求節點間時間同步。
• NTP是以階層式的架構來處理,叢集中只需
挑出一部與對外的NTP server同步,在台灣
可以參考國家時間與頻率標準實驗室。
• 設定細節可參考:
• http://linux.vbird.org/linux_server/0440ntp.p
hp#ps3
Download => http://goo.gl/MH8xS4 48
START INSTALL CLOUDERA
Download => http://goo.gl/MH8xS4 49
How to install Cloudera!!
• CDH5提供了三種方法來安裝:
– 透過Cloudera manager自動安裝
– 從各模組的安裝檔手動安裝
– 所有模組皆打包完畢一起安裝
• 自動安裝雖然較方便,但在網路環境不許
可的情況下,安裝過程出錯必須從頭再來。
• Spark、Impala在CDH5時已經打包進第三種
方式的安裝檔,可以不必額外安裝。
Download => http://goo.gl/MH8xS4 50
Download
• Manager安裝的過程及細節:
– 离线安装Cloudera Manager 5和CDH5(最新版
5.1.3) 完全教程
– Manual Installation Using Cloudera Manager
Tarballs
Download => http://goo.gl/MH8xS4 51
Install
• 主節點安裝完Cloudera manager後啟動如下
服務:
• agent的服務未來在每個slave節點都要啟動
# /opt/cm-5.1.3/etc/init.d/cloudera-scm-server start
# /opt/cm-5.1.3/etc/init.d/cloudera-scm-agent start
Download => http://goo.gl/MH8xS4 52
DEMO
• Cloudera Manager會跑在7180 port,可透過
WEB介面管理整個叢集。
• sudo -u hdfs hadoop jar /opt/cloudera/parcels/CDH/lib/hadoop-
mapreduce/hadoop-mapreduce-examples.jar pi 10 100
Download => http://goo.gl/MH8xS4 53
YARN
• Introduction to YARN and MapReduce 2
Download => http://goo.gl/MH8xS4 54

More Related Content

PPTX
架設Hadoop叢集以及mapreduce開發環境
PDF
How to plan a hadoop cluster for testing and production environment
PPTX
Hadoop安裝 (1)
PDF
2016-07-12 Introduction to Big Data Platform Security
PPT
Hadoop Map Reduce 程式設計
PDF
Apache hadoop and cdh(cloudera distribution) introduction 基本介紹
PDF
Hadoop ecosystem - hadoop 生態系
PDF
Full Stack Monitoring with Prometheus and Grafana (Updated)
架設Hadoop叢集以及mapreduce開發環境
How to plan a hadoop cluster for testing and production environment
Hadoop安裝 (1)
2016-07-12 Introduction to Big Data Platform Security
Hadoop Map Reduce 程式設計
Apache hadoop and cdh(cloudera distribution) introduction 基本介紹
Hadoop ecosystem - hadoop 生態系
Full Stack Monitoring with Prometheus and Grafana (Updated)

What's hot (20)

PDF
Kyligence Leverages Alluxio to Accelerate OLAP in the Cloud
PPTX
Hadoop hive
PDF
淺談 Kubernetes於大數據生態系的相關開發近況
PDF
大資料趨勢介紹與相關使用技術
PPTX
Hadoop 簡介 教師 許智威
PDF
Log collection
 
PPTX
Hadoop 設定與配置
PDF
Hadoop 0.20 程式設計
PDF
Something about Kafka - Why Kafka is so fast
PPTX
HDInsight for Microsoft Users
PDF
Introduction to K8S Big Data SIG
PDF
OpenStack and Docke Integration V6
PDF
基于Fuel的超融合一体机
PPTX
Docker open stack
PPT
Hadoop 與 SQL 的甜蜜連結
PDF
Use Alluxio to Unify Storage Systems in Suning
PDF
HDInsight for Hadoopers
PPTX
大数据漫谈-bilibili
PDF
Establish The Core of Cloud Computing Application by Using Hazelcast (Chinese)
PDF
HDFS-In-Cloud
Kyligence Leverages Alluxio to Accelerate OLAP in the Cloud
Hadoop hive
淺談 Kubernetes於大數據生態系的相關開發近況
大資料趨勢介紹與相關使用技術
Hadoop 簡介 教師 許智威
Log collection
 
Hadoop 設定與配置
Hadoop 0.20 程式設計
Something about Kafka - Why Kafka is so fast
HDInsight for Microsoft Users
Introduction to K8S Big Data SIG
OpenStack and Docke Integration V6
基于Fuel的超融合一体机
Docker open stack
Hadoop 與 SQL 的甜蜜連結
Use Alluxio to Unify Storage Systems in Suning
HDInsight for Hadoopers
大数据漫谈-bilibili
Establish The Core of Cloud Computing Application by Using Hazelcast (Chinese)
HDFS-In-Cloud
Ad

Viewers also liked (15)

PPTX
How to building WEKA model and automatic test by command line
PDF
451 Research Impact Report
PDF
The Future of Data
PDF
Hw09 Cloudera Desktop In Detail
PDF
Spark tuning2016may11bida
PDF
Introduction to YARN Apps
PDF
Yarns About Yarn
PPTX
Unlock Hadoop Success with Cloudera Navigator Optimizer
PDF
A beginners guide to Cloudera Hadoop
PDF
Hadoop administration using cloudera student lab guidebook
ODP
Hadoop & Cloudera Workshop
PDF
Cloudera Desktop
PDF
Hadoop I/O Analysis
PPTX
Data Science at Scale Using Apache Spark and Apache Hadoop
PDF
Hadoop Workshop using Cloudera on Amazon EC2
How to building WEKA model and automatic test by command line
451 Research Impact Report
The Future of Data
Hw09 Cloudera Desktop In Detail
Spark tuning2016may11bida
Introduction to YARN Apps
Yarns About Yarn
Unlock Hadoop Success with Cloudera Navigator Optimizer
A beginners guide to Cloudera Hadoop
Hadoop administration using cloudera student lab guidebook
Hadoop & Cloudera Workshop
Cloudera Desktop
Hadoop I/O Analysis
Data Science at Scale Using Apache Spark and Apache Hadoop
Hadoop Workshop using Cloudera on Amazon EC2
Ad

Similar to Cloudera introduction (20)

PPTX
Hadoop 介紹 20141024
PDF
Hadoop Deployment Model @ OSDC.TW
PDF
Hadoop con 2015 hadoop enables enterprise data lake
PDF
Track A-1: Cloudera 大數據產品和技術最前沿資訊報告
PPTX
Introduction to big data
PDF
Hadoop 2.0 之古往今來
PDF
雲端運算簡介
PPTX
hicloud PaaS雲創平台(Java/PHP介紹)
PDF
課程1 1:雲端運算初探
ODP
雲端技術的新趨勢
PPTX
Windows 與 Azure 的容器旅程 @ Ignite Mini 2016
PPTX
Running Hadoop on Amazon EC2
PPTX
What could hadoop do for us
PDF
企業導入微服務實戰 - updated
PPT
創新管理 雲端協同商務平台 V2.0
PPTX
Bigdata 大資料分析實務 (進階上機課程)
PDF
When R meet Hadoop
PDF
Hadoop+spark實作
 
PPT
Network Design in Cloud-ready IDC
PDF
企業導入容器經驗分享與開源技能培養
Hadoop 介紹 20141024
Hadoop Deployment Model @ OSDC.TW
Hadoop con 2015 hadoop enables enterprise data lake
Track A-1: Cloudera 大數據產品和技術最前沿資訊報告
Introduction to big data
Hadoop 2.0 之古往今來
雲端運算簡介
hicloud PaaS雲創平台(Java/PHP介紹)
課程1 1:雲端運算初探
雲端技術的新趨勢
Windows 與 Azure 的容器旅程 @ Ignite Mini 2016
Running Hadoop on Amazon EC2
What could hadoop do for us
企業導入微服務實戰 - updated
創新管理 雲端協同商務平台 V2.0
Bigdata 大資料分析實務 (進階上機課程)
When R meet Hadoop
Hadoop+spark實作
 
Network Design in Cloud-ready IDC
企業導入容器經驗分享與開源技能培養

Cloudera introduction