基於Centos7.6上Ambari2.7.4+HDP3.1.4離線安裝


概述

Ambari:基於Web的工具,支持Apache Hadoop集群的創建 、管理和監控。可以從apache官網下載源碼,自己定義開發自己需要的樣式。這里先設下一個伏筆,有興趣的可以跟着我的博客。后面會有apache-ambari二次開發。
HDP:包含了hadoop生態系統的所有軟件項目,比如HBase,Zookeeper,Hive,Pig等等。
HDP-UTILS:工具類庫。
HDP-GPL:LZO壓縮庫軟件包存儲在單獨的HDP-GPL存儲庫中。

  Ambari的最新版本為2.7.5,HDP的最新版本為3.1.5,通過 https://supportmatrix.hortonworks.com/ 可以查詢Ambari和HDP各個版本支持情況。本來想安裝最新版,但因為從2.7.5之后,訪問Ambari存儲庫需要身份驗證。具體官網截圖如下,(瀏覽器以翻譯為中文):  

 廢話不多說,開始搞起。

環境

系統:CentOS Linux release 7.6.1810 (Core)
內存:16G
cpu:1C
磁盤:100G
安裝介質:[ ambari-2.7.4.0-centos7.tar.gz | HDP-3.1.4.0-centos7-rpm.tar.gz | HDP-GPL-3.1.4.0-centos7-gpl.tar.gz | HDP-UTILS-1.1.0.22-centos7.tar.gz ]

設置主機名:

方法:之前博客 《TDH(Transwarp Data Hub)社區版安裝教程》中 設置主機名

設置root用戶登錄:

方法:之前博客 《TDH(Transwarp Data Hub)社區版安裝教程》中 設置root用戶登錄

設置集群免密:

方法:之前博客 《TDH(Transwarp Data Hub)社區版安裝教程》中 設置集群免密

設置selinux,集群時間同步,防火牆:

方法:之前博客 《TDH(Transwarp Data Hub)社區版安裝教程》中 設置selinux,集群時間同步,防火牆

補充:時間同步,這里配置的集群間,所有節點以主節點時間為准,都同步主節點時間

步驟:

注意事項:要注意的是,ntpd 有一個自我保護設置: 如果本機與上源時間相差太大, ntpd 不運行. 所以新設置的時間服務器一定要先 ntpdate 從上源取得時間初值, 然后啟動 ntpd服務。ntpd服務 運行后, 先是每64秒與上源服務器同步一次, 根據每次同步時測得的誤差值經復雜計算逐步調整自己的時間, 隨着誤差減小, 逐步增加同步的間隔.每次跳動, 都會重復這個調整的過程。

主節點配置

修改兩處:

restrict 10.32.8.0 mask 255.255.255.0 nomodify notrap

server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10

修改后具體參數:

[root@nn1 ~]# cat /etc/ntp.conf | grep -v ^# | grep -v ^$
driftfile /var/lib/ntp/drift
restrict default nomodify notrap nopeer noquery
restrict 127.0.0.1 
restrict ::1
restrict 10.32.8.0 mask 255.255.255.0 nomodify notrap
server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
disable monitor
View Code

修改配置后需要重啟ntpd服務:systemctl restart ntpd 

從節點配置

根據上面的注意事項,先同步主節點時間:ntpdate nn1

從節點修改一處:server nn1

修改后具體參數:

[root@dn1 ~]# cat /etc/ntp.conf | grep -v ^# | grep -v ^$
driftfile /var/lib/ntp/drift
restrict default nomodify notrap nopeer noquery
restrict 127.0.0.1 
restrict ::1
server nn1
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
disable monitor
View Code

啟動ntpd服務:systemctl start ntpd

除了上面的方法外還有一種,就是在從節點添加定時任務,同步主節點時間。

安裝jdk

所有節點安裝jdk:

[root@nn1 ~]# tar zxvf jdk-8u251-linux-x64.tar.gz -C /usr/local/

[root@nn1 ~]# mv /usr/local/jdk1.8.0_251/ /usr/local/jdk

環境變量:在/etc/profile 中添加
# for jdk
export JAVA_HOME=/usr/local/jdk
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin

刷新環境變量:source /etc/profile

檢查:
[root@nn1 ~]# java -version
java version "1.8.0_251"
Java(TM) SE Runtime Environment (build 1.8.0_251-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode)
View Code

關閉THP

所有節點在文件/etc/rc.d/rc.local中添加以下內容:

if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
    echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
    echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
View Code
[root@dn1 opt]# chmod +x /etc/rc.d/rc.local

修改文件打開最大限制

修改文件/etc/security/limits.conf,添加已下內容:

* soft nofile 65536 
* hard nofile 65536 
* soft nproc 131072 
* hard nproc 131072
View Code

設置本地源

在主節點安裝httpd服務,將所有的安裝介質解壓到httpd的網頁根目錄:

 

創建repo文件

位置:
[root@nn1 yum.repos.d]# pwd
/etc/yum.repos.d

內容:
[root@nn1 yum.repos.d]# cat ambari.repo
[ambari]
name=ambari
baseurl=http://10.32.8.33/ambari/centos7/2.7.4.0-118/
gpgcheck=1
enabled=1
gpgkey=http://10.32.8.33/ambari/centos7/2.7.4.0-118/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins

[HDP]
name=HDP
baseurl=http://10.32.8.33//HDP/centos7/3.1.4.0-315
gpgcheck=1
enabled=1
gpgkey=http://10.32.8.33//HDP/centos7/3.1.4.0-315/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins

[HDP-UTILS]
name=HDP-UTILS
baseurl=http://10.32.8.33/HDP-UTILS/centos7/1.1.0.22
gpgcheck=1
enabled=1
gpgkey=http://10.32.8.33/HDP-UTILS/centos7/1.1.0.22/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins

[HDP-GPL]
name=HDP-GPL
baseurl=http://10.32.8.33/HDP-GPL/centos7/3.1.4.0-315
gpgcheck=1
enabled=1
gpgkey=http://10.32.8.33/HDP-GPL/centos7/3.1.4.0-315/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
View Code

更新yum源查看

[root@nn1 yum.repos.d]# yum clean all
[root@nn1 yum.repos.d]# yum repolist all | grep enabled
View Code

 分發repo文件到所有節點

[root@nn1 yum.repos.d]# scp /etc/yum.repos.d/ambari.repo dn1:/etc/yum.repos.d/
hdp.local.repo                100%  720   312.7KB/s   00:00
[root@nn1 yum.repos.d]# scp /etc/yum.repos.d/ambari.repo dn2:/etc/yum.repos.d/
hdp.local.repo                100%  720   420.1KB/s   00:00
View Code

安裝ambari-server

[root@nn1 yum.repos.d]# yum -y install ambari-server
[root@nn1 yum.repos.d]# ambari-server setup
Using python  /usr/bin/python
Setup ambari-server
Checking SELinux...
SELinux status is 'enabled'
SELinux mode is 'enforcing'
Temporarily disabling SELinux
WARNING: SELinux is set to 'permissive' mode and temporarily disabled.
OK to continue [y/n] (y)? y
Customize user account for ambari-server daemon [y/n] (n)? y
Enter user account for ambari-server daemon (root):
Adjusting ambari-server permissions and ownership...
Checking firewall status...
Checking JDK...
[1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8
[2] Custom JDK
==============================================================================
Enter choice (1): 2
WARNING: JDK must be installed on all hosts and JAVA_HOME must be valid on all hosts.
WARNING: JCE Policy files are required for configuring Kerberos security. If you plan to use Kerberos,please make sure JCE Unlimited Strength Jurisdiction Policy Files are valid on all hosts.
Path to JAVA_HOME: /usr/local/jdk
Validating JDK on Ambari Server...done.
Check JDK version for Ambari Server...
JDK version found: 8
Minimum JDK version is 8 for Ambari. Skipping to setup different JDK for Ambari Server.
Checking GPL software agreement...
GPL License for LZO: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
Enable Ambari Server to download and install GPL Licensed LZO packages [y/n] (n)? y
Completing setup...
Configuring database...
Enter advanced database configuration [y/n] (n)? 
Configuring database...
Default properties detected. Using built-in database.
Configuring ambari database...
Checking PostgreSQL...
Running initdb: This may take up to a minute.
Initializing database ... OK


About to start PostgreSQL
Configuring local database...
Configuring PostgreSQL...
Restarting PostgreSQL
Creating schema and user...
done.
Creating tables...
done.
Extracting system views...
ambari-admin-2.7.4.0.118.jar
....
Ambari repo file doesn't contain latest json url, skipping repoinfos modification
Adjusting ambari-server permissions and ownership...
Ambari Server 'setup' completed successfully.
View Code

啟動ambari

[root@nn1 yum.repos.d]# ambari-server start
Using python  /usr/bin/python
Starting ambari-server
Ambari Server running with administrator privileges.
Organizing resource files at /var/lib/ambari-server/resources...
Ambari database consistency check started...
Server PID at: /var/run/ambari-server/ambari-server.pid
Server out at: /var/log/ambari-server/ambari-server.out
Server log at: /var/log/ambari-server/ambari-server.log
Waiting for server start.....................................................................
Server started listening on 8080

DB configs consistency check: no errors and warnings were found.
Ambari Server 'start' completed successfully.
View Code

成功啟動后在瀏覽器輸入Ambari地址:
http://10.32.8.33:8080 即可進入hdp安裝導航,用戶/密碼(admin/admin):

 登錄后點擊進入導航流程

 設置集群名

 版本選擇

 集群列表

 集群節點注冊

 選擇安裝的服務

 服務主組件分布

 分配 Slaves and Clients

為一些服務設置密碼

 為一些服務設置元數據存儲

在配置前需要先配置一下postgresql,如下:

在主節點的postgresql上創建hive數據庫,hive用戶,並將hive數據庫授權給hive用戶。
[root@nn1 ~]# su - postgres
Last login: Tue Jun 30 17:14:36 UTC 2020 on pts/2
-bash-4.2$ psql 
psql (9.2.24)
Type "help" for help.

postgres=# CREATE DATABASE hive;
CREATE DATABASE
postgres=# CREATE USER hive WITH PASSWORD 'hive';
CREATE ROLE
postgres=# GRANT ALL PRIVILEGES ON DATABASE hive TO hive;
GRANT
postgres=# \q

修改/var/lib/pgsql/data/pg_hba.conf文件
將
local  all  ambari,mapred md5
host  all   ambari,mapred 0.0.0.0/0  md5
host  all   ambari,mapred ::/0 md5

改為
local  all  ambari,mapred,hive md5
host  all   ambari,mapred,hive 0.0.0.0/0  md5
host  all   ambari,mapred.hive ::/0 md5

修改后,重新啟動postgresql: systemctl restart postgresql.service
View Code

設置完后需要測試一下

 后面就一路next就可以了

大約半個小時安裝完成

至此結束!!!

我看了下后台資源使用,三個節點,負載都不低,cpu爆滿,建議最小資源:4C+ 16G+ 100G+;


免責聲明!

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



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