Ubuntu14.04用apt在線/離線安裝CDH5.1.2[Apache Hadoop 2.3.0]


目錄

目錄

1、CDH介紹

1.1、什么是CDH和CM?

  CDH一個對Apache Hadoop的集成環境的封裝,可以使用Cloudera Manager進行自動化安裝。
  Cloudera-Managerceql(本文中簡稱CM)是一個工具,CM能夠管理一個大的Hadoop cluster並不是一只要下載tar files什么壓縮並啟動services這么簡單。后續有非常多設定、監控等麻煩的事要處理,CM都能夠做到,有些類似Casti。Cloudera Manager整合了一列的功能讓系統管理者能更方便的維護Hadoop。
  

1.2、CDH的主要功能?

  • 管理
  • 監控
  • 診斷
  • 集成

1.3、CDH版本衍化

  Hadoop是一個開源項目,所以很多公司在這個基礎進行商業化,Cloudera對hadoop做了相應的改變。
  Cloudera公司的發行版,我們將該版本稱為CDH(Cloudera Distribution Hadoop)。截至目前為止,CDH共有5個版本,其中,前兩個已經不再更新,最近的兩個,分別是CDH4在Apache Hadoop 2.0.0版本基礎上演化而來的),CDH5,它們每隔一段時間便會更新一次。
  Cloudera以Patch Level划分小版本,比如Patch Level為923.142表示在原生態Apache Hadoop 0.20.2基礎上添加了1065個Patch(這些Patch是各個公司或者個人貢獻的,在Hadoop jira上均有記錄),其中923個是最后一個Beta版本添加的Patch,而142個是穩定版發行后新添加的Patch。由此可見,Patch Level越高,功能越完備且解決的Bug越多。
  Cloudera版本層次更加清晰,且它提供了適用於各種操作系統的Hadoop安裝包,可直接使用apt-get或者yum命令進行安裝,更加省事。
  在CDH5以上的版本中,已經加入了Hadoop2.0的HA單點故障解決方案。可以參考《ubuntu12.04+hadoop2.2.0+zookeeper3.4.5+hbase0.96.2+hive0.13.1分布式環境部署》中的單點故障測試。
  

1.4、CDH5.1.2支持的主要組件簡要介紹

  • HTTPFS
      1:Httpfs是Cloudera公司提供的一個Hadoop Hdfs的一個Http接口,通過WebHDFS REST API 可以對hdfs進行讀寫等訪問
      2:與WebHDFS的區別是不需要客戶端可以訪問Hadoop集群的每一個節點,通過Httpfs可以訪問放置在防火牆后面的Hadoop集群
      3:Httpfs是一個Web應用,部署在內嵌的Tomcat中

  • HBASE
      Hbase是Bigtable的開源山寨版本。是建立的Hdfs之上,提供高可靠性、高性能、列存儲、可伸縮、實時讀寫的數據庫系統。
      它介於Bosql和RDBMS之間,僅能通過主鍵(row key)和主鍵的Range來檢索數據,僅支持單行事務(可通過Hive支持來實現多表Join等復雜操作)。主要用來存儲非結構化和半結構化的松散數據。
      與Hadoop一樣,Hbase目標主要依靠橫向擴展,通過不斷增加廉價的商用服務器,來增加計算和存儲能力。

  • HDFS
      Hadoop分布式文件系統(HDFS)被設計成適合運行在通用硬件(commodity hardware)上的分布式文件系統。它和現有的分布式文件系統有很多共同點。但同時,它和其他的分布式文件系統的區別也是很明顯的。HDFS是一個高度容錯性的系統,適合部署在廉價的機器上。HDFS能提供高吞吐量的數據訪問,非常適合大規模數據集上的應用。HDFS放寬了一部分POSIX約束,來實現流式讀取文件系統數據的目的。HDFS在最開始是作為Apache Nutch搜索引擎項目的基礎架構而開發的。HDFS是Apache Hadoop Core項目的一部分。

  • HIVE
      Hive 是一個基於 Hadoop 的開源數據倉庫工具,用於存儲和處理海量結構化數據。它把海量數據存儲於 Hadoop 文件系統,而不是數據庫,但提供了一套類數據庫的數據存儲和處理機制,並采用 HQL (類 SQL )語言對這些數據進行自動化管理和處理。我們可以把 Hive 中海量結構化數據看成一個個的表,而實際上這些數據是分布式存儲在 HDFS 中的。 Hive 經過對語句進行解析和轉換,最終生成一系列基於 hadoop 的 Map/Reduce 任務,通過執行這些任務完成數據處理。

  • HUE
      Hue是CDH專門的一套WEB管理器,它包括3個部分Hue Ui,Hue Server,Hue db。Hue提供所有的CDH組件的Shell界面的接口。你可以在Hue編寫MR,查看修改HDFS的文件,管理Hive的元數據,運行Sqoop,編寫Oozie工作流等大量工作。

  • Impala
      Impala對你存儲在Apache Hadoop在HDFS,HBase的數據提供直接查詢互動的SQL。除了像Hive使用相同的統一存儲平台,Impala也使用相同的元數據,SQL語法(Hive SQL),ODBC驅動程序和用戶界面(Hue Beeswax)。Impala還提供了一個熟悉的面向批量或實時查詢和統一平台。

  • MapReduce
      MapReduce是一種編程模型,用於大規模數據集(大於1TB)的並行運算。概念"Map(映射)"和"Reduce(歸約)",和他們的主要思想,都是從函數式編程語言里借來的,還有從矢量編程語言里借來的特性。他極大地方便了編程人員在不會分布式並行編程的情況下,將自己的程序運行在分布式系統上。 當前的軟件實現是指定一個Map(映射)函數,用來把一組鍵值對映射成一組新的鍵值對,指定並發的Reduce(歸約)函數,用來保證所有映射的鍵值對中的每一個共享相同的鍵組。MapReduce更多運行於離線系統,而實時計算,可以使用Storm。關於Sotrm的使用和介紹,可以參考這篇文章《ubuntu12.04+storm0.9.2分布式集群的搭建》。

  • Oozie
      Oozie是Yahoo針對Apache Hadoop開發的一個開源工作流引擎。用於管理和協調運行在Hadoop平台上(包括:HDFS、Pig和MapReduce)的Jobs。Oozie是專為雅虎的全球大規模復雜工作流程和數據管道而設計。

  • Solr
      Solr是一個基於Lucene的Java搜索引擎服務器。Solr 提供了層面搜索、命中醒目顯示並且支持多種輸出格式(包括 XML/XSLT 和 JSON 格式)。它易於安裝和配置,而且附帶了一個基於 HTTP 的管理界面。Solr已經在眾多大型的網站中使用,較為成熟和穩定。Solr 包裝並擴展了 Lucene,所以Solr的基本上沿用了Lucene的相關術語。更重要的是,Solr 創建的索引與 Lucene 搜索引擎庫完全兼容。通過對 Solr 進行適當的配置,某些情況下可能需要進行編碼,Solr 可以閱讀和使用構建到其他 Lucene 應用程序中的索引。此外,很多 Lucene 工具(如Nutch、 Luke)也可以使用 Solr 創建的索引。

  • Spark
      Spark是UC Berkeley AMP lab所開源的類Hadoop MapReduce的通用的並行計算框架,Spark基於map reduce算法實現的分布式計算,擁有Hadoop MapReduce所具有的優點;但不同於MapReduce的是Job中間輸出結果可以保存在內存中,從而不再需要讀寫HDFS,因此Spark能更好地適用於數據挖掘與機器學習等需要迭代的map reduce的算法。
      Spark和Storm類似,都是基於內存的運行,不確定哪種方式在數據吞吐量上要具優勢,不過Storm計算時間延遲要小。關於Sotrm的使用和介紹,可以參考這篇文章《ubuntu12.04+storm0.9.2分布式集群的搭建》。

  • Sqoop
      Sqoop中一大亮點就是可以通過hadoop的mapreduce把數據從關系型數據庫中導入數據到HDFS。sqoop架構非常簡單,其整合了Hive、Hbase和Oozie,通過map-reduce任務來傳輸數據,從而提供並發特性和容錯。sqoop主要通過JDBC和關系數據庫進行交互。理論上支持JDBC的database都可以使用sqoop和hdfs進行數據交互。
      

  • YARN
      YARN可以理解為是Hadoop MapReduceV2版本,YARN重構根本的思想是將 JobTracker 兩個主要的功能分離成單獨的組件,這兩個功能是資源管理和任務調度 / 監控。新的資源管理器全局管理所有應用程序計算資源的分配,每一個應用的 ApplicationMaster 負責相應的調度和協調。一個應用程序無非是一個單獨的傳統的 MapReduce 任務或者是一個 DAG( 有向無環圖 ) 任務。ResourceManager 和每一台機器的節點管理服務器能夠管理用戶在那台機器上的進程並能對計算進行組織。
      事實上,每一個應用的 ApplicationMaster 是一個詳細的框架庫,它結合從 ResourceManager 獲得的資源和 NodeManager 協同工作來運行和監控任務。

  • Zookeeper
      Zookeeper 分布式服務框架是 Apache Hadoop 的一個子項目,它主要是用來解決分布式應用中經常遇到的一些數據管理問題,如:統一命名服務、狀態同步服務、集群管理、分布式應用配置項的管理等。
      Zookeeper 作為一個分布式的服務框架,主要用來解決分布式集群中應用系統的一致性問題,它能提供基於類似於文件系統的目錄節點樹方式的數據存儲,但是 Zookeeper 並不是用來專門存儲數據的,它的作用主要是用來維護和監控你存儲的數據的狀態變化。通過監控這些數據狀態的變化,從而可以達到基於數據的集群管理。

2、CDH的官網在哪里?

  http://www.cloudera.com/

3、CDH在哪里下載?

  由於CDH有多個版本,作者不建議單獨下載安裝,可以通過cloudera-manager-daemons、cloudera-manager-server、cloudera-manager-agent來安裝,本文后面會有介紹。

4、如何安裝

4.1、設置Host

  修改Host

root@m1:~# cat /etc/hosts 
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.10    m1.idoall.org   m1
192.168.1.11    m2.idoall.org   m2
192.168.1.12    s1.idoall.org   s1
192.168.1.13    s2.idoall.org   s2
 
 
# The following lines are desirable for IPv6 capable hosts
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

4.2、設置靜態IP

  修改成靜態IP地址

root@m1:~# vi /etc/network/interfaces
iface wlan0 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1
dns-nameservers 8.8.8.8

4.3、設置Host

  修改主機名稱

root@m1:~# cat /etc/hostname 
m1.idoall.org

4.4、關閉防火牆

root@m1:~# ufw disable

4.5、安裝JDK7,CDH5要求至少是Oracle JDK7

  添加 PPA repository 到系統

root@m1:~# add-apt-repository ppa:webupd8team/java
root@m1:~# apt-get update
root@m1:~# sudo apt-get upgrade

  過程中會彈出個框,選擇YES,因為要下載二進制包,所以可能會慢一些

root@m1:~# apt-get install oracle-java7-installer

  
  將Oracle 7 設置成默認版本

root@m1:~# apt-get install oracle-java7-set-default

  
  查看當前Java版本

root@m1:~# java -version 
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01) 
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

4.6、安裝MySql最新版,CM的數據庫我們用My Sql管理

  安裝Mysql Server,后面在安裝Cloudera Manager的時候會用到,如果你要使用PostGreSQL ,可以跳過這一步 (4.6-4.8)。
  

4.6.1、在主機上使用apt-get安裝My Sql

  在主機上使用apt-get安裝My Sql,安裝過程中會有提示,一直接回車就可以 (4台機器都要執行)

root@m1:~# apt-get install mysql-server

4.6.2、修改MySql配置,方便CM使用

4.6.2.1、配置MySql的監聽地址

  對Mysql的配置項進行修改,先備份,找到“bind-address = 127.0.0.1”這一行,然后注釋掉,改成“bind-address = 0.0.0.0”

root@m1:~# cp /etc/mysql/my.cnf /etc/mysql/my.cnf.bak 
root@m1:~# vi /etc/mysql/my.cnf 
#bind-address = 127.0.0.1 
bind-address = 0.0.0.0

4.6.2.2、配置MySql的其他配置,為了CM使用

  MySql配置中,其中對於Cloudera的支持,可以參考官方描述

[client]
default-character-set=utf8
[mysqld]
transaction-isolation=READ-COMMITTED
# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0
character-set-server=utf8
key_buffer              = 16M
key_buffer_size         = 32M
max_allowed_packet      = 32M
thread_stack            = 256K
thread_cache_size       = 64
query_cache_limit       = 8M
query_cache_size        = 64M
query_cache_type        = 1
 
max_connections         = 550
 
# log-bin should be on a disk with enough free space
# NOTE: replace '/x/home/mysql/logs/binary' below with
#       an appropriate path for your system.
log-bin=/x/home/mysql/logs/binary/mysql_binary_log
 
# For MySQL version 5.1.8 or later. Comment out binlog_format for older versions.
binlog_format           = mixed
 
read_buffer_size = 2M
read_rnd_buffer_size = 16M
sort_buffer_size = 8M
join_buffer_size = 8M
 
# InnoDB settings
innodb_file_per_table = 1
innodb_flush_log_at_trx_commit  = 2
innodb_log_buffer_size          = 64M
innodb_buffer_pool_size         = 4G
innodb_thread_concurrency       = 8
innodb_flush_method             = O_DIRECT
innodb_log_file_size = 512M
 
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

4.7、創建后面在CM中會使用的數據庫

root@m1:~# mysql -u root -p 
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g. 
Your MySQL connection id is 42 
Server version: 5.5.38-0ubuntu0.14.04.1 (Ubuntu) 
 
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 
 
Oracle is a registered trademark of Oracle Corporation and/or its 
affiliates. Other names may be trademarks of their respective 
owners. 
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 
 
## Cloudera manager db user, database and grant
mysql> create user 'cmf'@'%' identified by 'xyz'; 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> create database cmf  DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec) 
 
mysql> grant all privileges on cmf.* to 'cmf'@'%' identified by 'xyz'; 
Query OK, 0 rows affected (0.00 sec) 
 
## For activity monitor 
mysql> create user 'amon'@'%' identified by 'xyz'; 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> create database amon  DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec) 
 
mysql> grant all privileges on amon.* to 'amon'@'%' identified by 'xyz'; 
Query OK, 0 rows affected (0.00 sec) 
 
## Hive Meta store 
mysql> create user 'hive'@'%' identified by 'xyz'; 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> create database metastore  DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec) 
 
mysql> grant all privileges on metastore.* to 'hive'@'%' identified by 'xyz'; 
Query OK, 0 rows affected (0.00 sec) 
 
## Flush all changes 
mysql> FLUSH PRIVILEGES; 
Query OK, 0 rows affected (0.00 sec)

4.8、重啟MySql,查看3306端口,並安裝MySql對Java的支持

root@m1:~# service mysql restart
root@m1:~# netstat -tulpn | grep :3306 
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2207/mysqld
root@m1:~# apt-get install libmysql-java 
Reading package lists... Done 
Building dependency tree 
Reading state information... Done 
Suggested packages: 
liblog4j1.2-java libcommons-logging-java 
The following NEW packages will be installed: 
libmysql-java 
0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded. 
Need to get 894 kB of archives. 
After this operation, 1,060 kB of additional disk space will be used. 
Get:1 http://mirrors.sohu.com/ubuntu/ trusty/universe libmysql-java all 5.1.28-1 [894 kB] 
Fetched 894 kB in 1s (718 kB/s) 
Selecting previously unselected package libmysql-java. 
(Reading database ... 96338 files and directories currently installed.) 
Preparing to unpack .../libmysql-java_5.1.28-1_all.deb ... 
Unpacking libmysql-java (5.1.28-1) ... 
Setting up libmysql-java (5.1.28-1) ... 
root@m1:~#

4.9、安裝Cloudera Manager組件

4.9.1、將Ubuntu 14.04暫時偽造成Ubuntu12.04

  Ubuntu 14.04暫時偽造成Ubuntu12.04,因為在寫本文時CM現在還不支持14.04這個版本,CDH以后的版本應該會支持吧(4台機器都要執行)
  備份文件:

root@m1:~# cp /etc/lsb-release /etc/lsb-release.bak 

  使用VI編譯文件,暫時修改成Ubuntu12.04 LTS的信息:

root@m1:~# vi /etc/lsb-release 
DISTRIB_ID=Ubuntu 
DISTRIB_RELEASE=12.04 
DISTRIB_CODENAME=precise 
DISTRIB_DESCRIPTION="Ubuntu 12.04.3 LTS"

4.9.2、升級Ubuntu的utils包,CM所必需要

  在所有機器上安裝debian的包,升級utils,執行以下命令:(4台機器都要執行)

root@m1:~# wget http://ftp.cn.debian.org/debian/pool/main/f/fuse/fuse-utils_2.9.0-2+deb7u1_all.deb
root@m1:~# dpkg -i fuse-utils_2.9.0-2+deb7u1_all.deb

  

4.9.3、將CDH5的軟件源添加到Apt中

root@m1:~# curl "http://archive.cloudera.com/cm5/ubuntu/precise/amd64/cm/cloudera.list" -o /etc/apt/sources.list.d/cloudera_precise.list
root@m1:~# curl -s http://archive.cloudera.com/cdh5/ubuntu/precise/amd64/cdh/archive.key | sudo apt-key add -
root@m1:~# apt-get update

4.9.4、安裝Cloudera Manager

  安裝Cloudera Manager(4台機器都要執行)

root@m1:~# apt-get install cloudera-manager-daemons cloudera-manager-server

4.9.5、修改Cloudera-Manager-Server的配置文件db.properties,設置MySql連接

  修改Cloudera-Manager-Server的配置文件db.properties,設置剛才我們在(4.7)Mysql中創建的cmf數據庫、用戶名、密碼(4台機器都要執行)

root@m1:~# vi /etc/cloudera-scm-server/db.properties 
com.cloudera.cmf.db.type=mysql
com.cloudera.cmf.db.host=m1.idoall.org
com.cloudera.cmf.db.name=cmf
com.cloudera.cmf.db.user=cmf
com.cloudera.cmf.db.password=xyz

4.9.6、安裝ntp ,CM agents需要用到"ntpdc"

  安裝ntp ,CM agents需要用到"ntpdc"(4台機器都要執行)

root@m1:~# apt-get install ntp 
Reading package lists... Done 
Building dependency tree 
Reading state information... Done 
The following extra packages will be installed: 
libopts25 
Suggested packages: 
ntp-doc 
The following NEW packages will be installed: 
libopts25 ntp 
0 upgraded, 2 newly installed, 0 to remove and 4 not upgraded. 
Need to get 666 kB of archives. 
After this operation, 1,668 kB of additional disk space will be used. 
Do you want to continue? [Y/n] y 
Get:1 http://mirrors.sohu.com/ubuntu/ trusty/main libopts25 amd64 1:5.18-2ubuntu2 [55.3 kB] 
Get:2 http://mirrors.sohu.com/ubuntu/ trusty/main ntp amd64 1:4.2.6.p5+dfsg-3ubuntu2 [611 kB] 
Fetched 666 kB in 1s (537 kB/s) 
Selecting previously unselected package libopts25:amd64. 
(Reading database ... 95843 files and directories currently installed.) 
Preparing to unpack .../libopts25_1%3a5.18-2ubuntu2_amd64.deb ... 
Unpacking libopts25:amd64 (1:5.18-2ubuntu2) ... 
Selecting previously unselected package ntp. 
Preparing to unpack .../ntp_1%3a4.2.6.p5+dfsg-3ubuntu2_amd64.deb ... 
Unpacking ntp (1:4.2.6.p5+dfsg-3ubuntu2) ... 
Processing triggers for man-db (2.6.7.1-1) ... 
Processing triggers for ureadahead (0.100.0-16) ... 
Setting up libopts25:amd64 (1:5.18-2ubuntu2) ... 
Setting up ntp (1:4.2.6.p5+dfsg-3ubuntu2) ... 
* Starting NTP server ntpd [ OK ] 
Processing triggers for libc-bin (2.19-0ubuntu6.1) ... 
Processing triggers for ureadahead (0.100.0-16) ... 
root@m1:~#

  

4.9.7、重啟Cloudera Manager Server

  啟動Cloudera manager (4台機器都要執行)

root@m1:~# service cloudera-scm-server start 
Starting cloudera-scm-server: * cloudera-scm-server started 
root@m1:~#

  查看Cloudera manager的啟動日志,如果能夠看到下面的類似信息,說明啟動正確,tailf -100 /var/log/cloudera-scm-server/cloudera-scm-server.log或者/var/log/cloudera-scm-server/cloudera-scm-server.out,如果看不到類似下面的信息,那么也可以看到哪里出了問題,大多數都是和數據庫的配置有關系。

2014-08-26 23:07:52,643 INFO [JvmPauseMonitor:debug.JvmPauseMonitor@236] Detected pause in JVM or host machine (e.g. a stop the world GC, or JVM not scheduled): paused approximately 1182ms: GC pool 'Copy' had collection(s): count=1 time=1641ms 
2014-08-26 23:07:52,644 INFO [JvmPauseMonitor:debug.JvmPauseMonitor@236] Detected pause in JVM or host machine (e.g. a stop the world GC, or JVM not scheduled): paused approximately 1634ms: GC pool 'Copy' had collection(s): count=1 time=1641ms 
2014-08-26 23:07:52,696 INFO [WebServerImpl:servlet.DispatcherServlet@339] FrameworkServlet 'Spring MVC Dispatcher Servlet': initialization completed in 18068 ms 
2014-08-26 23:07:52,793 INFO [WebServerImpl:cmon.JobDetailGatekeeper@127] ActivityMonitor configured to allow job details for all jobs. 
2014-08-26 23:07:53,407 INFO [SearchRepositoryManager-0:components.SearchRepositoryManager@399] Initializing SearchTemplateManager:2014-08-27T06:07:53.407Z 
2014-08-26 23:07:53,730 INFO [SearchRepositoryManager-0:components.SearchRepositoryManager@403] Generating entities:2014-08-27T06:07:53.730Z 
2014-08-26 23:07:53,821 INFO [SearchRepositoryManager-0:components.SearchRepositoryManager@407] Num entities:112 
2014-08-26 23:07:53,822 INFO [SearchRepositoryManager-0:components.SearchRepositoryManager@409] Generating documents:2014-08-27T06:07:53.822Z 
2014-08-26 23:07:53,891 INFO [SearchRepositoryManager-0:components.SearchRepositoryManager@411] Num docs:124 
2014-08-26 23:07:53,892 INFO [SearchRepositoryManager-0:components.SearchRepositoryManager@352] Constructing repo:2014-08-27T06:07:53.892Z 
2014-08-26 23:07:53,979 INFO [WebServerImpl:mortbay.log@67] jetty-6.1.26.cloudera.2 
2014-08-26 23:07:54,008 INFO [WebServerImpl:mortbay.log@67] Started SelectChannelConnector@0.0.0.0:7180 
2014-08-26 23:07:54,009 INFO [WebServerImpl:cmf.WebServerImpl@292] Started Jetty server. 
2014-08-26 23:07:55,276 INFO [SearchRepositoryManager-0:components.SearchRepositoryManager@354] Finished constructing repo:2014-08-27T06:07:55.276Z

4.10、通過Web方式繼續安裝

4.10.1、創建update-alternatives工具在/usr/sbin/下創建軟鏈

  創建update-alternatives工具在/usr/sbin/下創建軟鏈(在4台機器上一起執行)(4台機器都要執行)

root@m1:~# sudo ln -s /usr/bin/update-alternatives /usr/sbin/update-alternatives

4.10.2、打開瀏覽器,輸入 http://m1.idoall.org:7180/ 開始安裝

  使用瀏覽器打開能夠看到登錄頁面,那么恭喜你成功了。 http://m1.idoall.org:7180/(帳號和密碼都是admin)
  enter image description here

  

4.10.3、選擇安裝的CDH版本

  我們來安裝Cloudera Express,之前官方有說這個版本有50個節點的限制,在CDH5.1.0版本也有看到,在寫本文記錄時的5.1.2版本不知道為什么我在安裝的時候並未看到。
  enter image description here

4.10.4、為CDH集群添加主機

  選擇指定的CDH集群,可以添加多台機器,也可以使用IP匹配,輸入完機器名稱后,點search按鈕,我輸入的內容為"m1.idoall.org"
  enter image description here

  CDH會根據你給出的內容,搜索到機器
  enter image description here

4.10.5、選擇CDH的安裝方式

  選擇存儲方式,我們使用Parcel方式安裝。系統會自動下載Parcel
  enter image description here

  
  是否需要加密,如果你不考慮這些,可以不用選擇這個復選框
  enter image description here

  
  提供SSH登錄憑據,這里建議使用root帳號,避免一些新同學,對其他帳號的權限設置不完整,導致后面安裝出現錯誤。如何設置4台機器之前SSH免密碼登錄,就不在這里介紹了,如果不會,可以去搜索下。在這之前4台機器請配置好SSH免密碼登錄。
  enter image description here

  
  安裝過程中的狀態,會下載CDH使用的包,可能會慢一些,要有耐心~~~~
  enter image description here

  
  如果在安裝過程中出現了以下錯誤“ImportError: No module named _io”,或者如下圖中的提示,不用擔心,這是一個已知問題。這是因為CDH5使用的Python版本問題。執行完下面的腳本后,點擊重試就可以順利的完成安裝了。如果出現打不開CM Agent的log日志提示,那很可能是你的Host配置有問題,請參考本文最初寫的Host配置。

root@m1:~# mv /usr/lib/cmf/agent/build/env/bin/python /usr/lib/cmf/agent/build/env/bin/python.bak
root@m1:~# cp /usr/bin/python2.7 /usr/lib/cmf/agent/build/env/bin/python

  enter image description here
  
  安裝完成了
  enter image description here

4.10.6、離線方式安裝CDH的Parcel

  繼續安裝選定 Parcel
  如果你想要提高速度,可以按以下方法離線安裝
    (1)、使用迅雷到http://archive.cloudera.com/cdh5/parcels/5.1.2/目錄,下載CDH-5.1.2-1.cdh5.1.2.p0.3-precise.parcel和mainfest.json文件
    (2)、上傳到/opt/cloudera/parcel-repo目錄中,同時創建一個CDH-5.1.2-1.cdh5.1.2.p0.3-precise.parcel.sha文件,內容為"a492e4b6dece2850f0a37f2bf613ecb2980dfd37",這個值可以在下載目錄中的manifest.json文件中找到。然后看相對應的json->parcelName同一級的hash值。
    (3)、下載http://archive.cloudera.com/accumulo-c5/parcels/1.6.0.51/ACCUMULO-1.6.0-1.cdh5.1.0.p0.51-precise.parcel、http://archive.cloudera.com/sqoop-connectors/parcels/1.2/SQOOP_NETEZZA_CONNECTOR-1.2c5-precise.parcel、http://archive.cloudera.com/sqoop-connectors/parcels/1.2/SQOOP_TERADATA_CONNECTOR-1.2c5-precise.parcel
    (4)、參考步驟2,創建相應的.sha文件,.sha文件中的內容如下:

root@m1:/opt/cloudera/parcel-repo# echo "a719f373833a63108c616afb034d97c4e11405d5" >> ACCUMULO-1.6.0-1.cdh5.1.0.p0.51-precise.parcel.sha
root@m1:/opt/cloudera/parcel-repo# echo "a492e4b6dece2850f0a37f2bf613ecb2980dfd37"  >> CDH-5.1.2-1.cdh5.1.2.p0.3-precise.parcel.sha
root@m1:/opt/cloudera/parcel-repo# echo "48bedfff38f742d32541854e24b3310992616027" >> SQOOP_NETEZZA_CONNECTOR-1.2c5-precise.parcel.sha
root@m1:/opt/cloudera/parcel-repo# echo "76566b4797bd061d01cf25b36b21b26927ada9a4" >> SQOOP_TERADATA_CONNECTOR-1.2c5-precise.parcel.sha

    (5)、設置文件的使用權限

root@m1:/opt/cloudera/parcel-repo# chmod 777 -R .
root@m1:/opt/cloudera/parcel-repo# chown cloudera-scm:cloudera-scm ./*

    (6)、查看下載后的文件列表

root@m1:/opt/cloudera/parcel-repo# ll 
total 1709280 
drwxrwxrwx 2 cloudera-scm cloudera-scm 4096 Sep 1 01:16 ./ 
drwxr-xr-x 6 root root 4096 Sep 1 01:51 ../ 
-rwxrwxrwx 1 cloudera-scm cloudera-scm 13204338 Aug 31 21:37 ACCUMULO-1.6.0-1.cdh5.1.0.p0.51-precise.parcel* 
-rwxrwxrwx 1 cloudera-scm cloudera-scm 41 Sep 1 01:15 ACCUMULO-1.6.0-1.cdh5.1.0.p0.51-precise.parcel.sha* 
-rwxrwxrwx 1 cloudera-scm cloudera-scm 1727519860 Sep 1 00:27 CDH-5.1.2-1.cdh5.1.2.p0.3-precise.parcel* 
-rwxrwxrwx 1 cloudera-scm cloudera-scm 41 Sep 1 01:15 CDH-5.1.2-1.cdh5.1.2.p0.3-precise.parcel.sha* 
-rwxrwxrwx 1 cloudera-scm cloudera-scm 41602 Sep 1 01:13 SQOOP_NETEZZA_CONNECTOR-1.2c5-precise.parcel* 
-rwxrwxrwx 1 cloudera-scm cloudera-scm 41 Sep 1 01:16 SQOOP_NETEZZA_CONNECTOR-1.2c5-precise.parcel.sha* 
-rwxrwxrwx 1 cloudera-scm cloudera-scm 9499051 Sep 1 01:13 SQOOP_TERADATA_CONNECTOR-1.2c5-precise.parcel* 
-rwxrwxrwx 1 cloudera-scm cloudera-scm 41 Sep 1 01:16 SQOOP_TERADATA_CONNECTOR-1.2c5-precise.parcel.sha*

   enter image description here 
   
  主機正確性檢查,和當前m1.idoall.org的CDH5.12組件版本匯總。
  enter image description here
    
  enter image description here  
    

4.10.7、在m1.idoall.org上安裝ZooKeeper服務

  選擇要安裝的集群服務,我們來安裝ZooKeeper。如下圖選擇
  enter image description here
  
  自定義角色分配
  enter image description here
  
  數據庫設置,我們輸入之前在MySql中(4.7)創建的Activity Monitor使用的數據庫amon以及用戶名、密碼,點擊測試鏈接,可以看到成功信息。
  enter image description here
  
  審核更改,如果你沒有郵件要配置,可以什么都不用輸入
  enter image description here
  
  
  升級完成,並且成功啟動ZooKeeper、CM Service服務。
  enter image description here
  

4.10.8、初始化完成,進入CM主頁

  升級完成,就可以進入主頁
  enter image description here
  
  查看m1.idoall.org的運行狀態
  enter image description here

4.10.9、恢復Ubuntu 14.04版本信息

  最后我們恢復ubuntu 14.04版本信息

root@cm1:~# rm /etc/lsb-release /etc/lsb-release.bak
root@cm1:~# mv /etc/lsb-release.bak  /etc/lsb-release

  

4.11、通過CM管理多個集群

4.11.1、添加1個新的集群,機器名稱為m2.idoall.org

  有的時候,因為業務原因,不同的服務我們要使用不同的集群,便於管理和維護,下面我們再使用CM來測試創建一個新集群Cluster 2
  添加其他主機,我們測試將m2.idoall.org也做為一個新集群添加到CM中。點擊CM主頁右上角的添加集群,會重復看到(參考4.10.4章節)的頁面
  
  enter image description here
  
  enter image description here
  

  再繼續安裝,可以參考(4.10.5章節-4.10.7章節)的頁面重復操作,下面只給出將m2.idoall.org加入到集群的安裝過程中部分截圖。
  m2.idoall.org機器上要有cloudera-manager-server、cloudera-manager-daemons、cloudera-manager-agent(這個可以不用安裝,但機器上要有包)。cloudera-manager-server、cloudera-manager-daemons的安裝,可以參考4.9.4章節,配置可以參考4.9.5章節,服務是啟動狀態。
  enter image description here
  
  enter image description here
  
  enter image description here

4.11.2、完成安裝,驗證m2.idoall.org是否成功地添加到集群Cluster 2

  enter image description here

4.12、向1個集群添加1台新主機

4.12.1、開始添加,輸入要添加的機器名稱s1.idoall.org

  enter image description here
  
  選擇存儲庫,為了保持統一,建議使用與當前CM一樣的版本,然后會繼續走4.10.5的步驟
  enter image description here
  
  再繼續安裝,可以參考(4.10.5章節-4.10.7章節)的頁面重復操作,下面只給出將s1.idoall.org加入到集群的安裝過程中部分截圖。
  m2.idoall.org機器上要有cloudera-manager-server、cloudera-manager-daemons、cloudera-manager-agent(這個可以不用安裝,但機器上要有包)。
  cloudera-manager-server、cloudera-manager-daemons的安裝,可以參考4.9.4章節,配置參考4.9.5章節。cloudera-manager-server的服務要在啟動狀態。
  enter image description here
  
  enter image description here

4.12.2、選擇主機模

  enter image description here
  
  enter image description here
  
  enter image description here

4.12.3、完成將s1.idoall.org添加到集群

  enter image description here

4.12.4、驗證s1.idoall.org是否成功地添加到集群Cluster 1

  enter image description here
  
  enter image description here

  到此為主,在Ubuntu14.04下使用apt-get方式,安裝CDH5.12已經成功。並且支持中文,后面有什么服務或者機器要添加的,可以自己來做了。

5、FAQ

5.1、過程中如果出現”Incorrect string value: '\x“的提示

  是和數據庫的編碼有關,在mysql中執行以下語句:

alter table CLIENT_CONFIGS convert to character set utf8;
alter table CLUSTERS convert to character set utf8;
alter table CLUSTERS_AUD convert to character set utf8;
alter table CLUSTER_ACTIVATED_RELEASES convert to character set utf8;
alter table CLUSTER_ACTIVATED_RELEASES_AUD convert to character set utf8;
alter table CLUSTER_MANAGED_RELEASES convert to character set utf8;
alter table CLUSTER_UNDISTRIBUTED_RELEASES convert to character set utf8;
alter table CM_PEERS convert to character set utf8;
alter table CM_VERSION convert to character set utf8;
alter table COMMANDS convert to character set utf8;
alter table COMMAND_SCHEDULES convert to character set utf8;
alter table CONFIGS convert to character set utf8;
alter table CONFIGS_AUD convert to character set utf8;
alter table CONFIG_CONTAINERS convert to character set utf8;
alter table CREDENTIALS convert to character set utf8;
alter table GLOBAL_SETTINGS convert to character set utf8;
alter table HOSTS convert to character set utf8;
alter table HOSTS_AUD convert to character set utf8;
alter table HOST_TEMPLATES convert to character set utf8;
alter table HOST_TEMPLATE_TO_ROLE_CONF_GRP convert to character set utf8;
alter table METRICS convert to character set utf8;
alter table PARCELS convert to character set utf8;
alter table PARCEL_COMPONENTS convert to character set utf8;
alter table PROCESSES convert to character set utf8;
alter table PROCESS_ACTIVE_RELEASES convert to character set utf8;
alter table RELEASES convert to character set utf8;
alter table RELEASES_AUD convert to character set utf8;
alter table REVISIONS convert to character set utf8;
alter table ROLES convert to character set utf8;
alter table ROLES_AUD convert to character set utf8;
alter table ROLE_CONFIG_GROUPS convert to character set utf8;
alter table ROLE_CONFIG_GROUPS_AUD convert to character set utf8;
alter table ROLE_STALENESS_STATUS convert to character set utf8;
alter table SCHEMA_VERSION convert to character set utf8;
alter table SERVICES convert to character set utf8;
alter table SERVICES_AUD convert to character set utf8;
alter table SNAPSHOT_POLICIES convert to character set utf8;
alter table USERS convert to character set utf8;
alter table USER_ROLES convert to character set utf8;
alter table USER_SETTINGS convert to character set utf8;

博文作者:迦壹 博客地址:[Ubuntu14.04用apt在線/離線安裝CDH5.1.2[Apache Hadoop 2.3.0]](http://idoall.org/blog/post/lion/11) 寫作時間:2014-09-02 01:18 轉載聲明:可以轉載, 但必須以超鏈接形式標明文章原始出處和作者信息及版權聲明,謝謝合作!



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM