一、伺服器環境配置
1 系統要求
名稱 |
地址 |
作業系統 |
root密碼 |
Master1 |
10.1.0.30 |
Centos 7.7 |
|
Master2 |
10.1.0.105 |
Centos 7.7 |
|
Worker1 |
10.1.0.127 |
Centos 7.7 |
|
Worker2 |
10.1.0.106 |
Centos 7.7 |
|
Worker3 |
10.1.0.3 |
Centos 7.7 |
|
系統要求 |
Centos 7.3以上 64bit 最小化安裝 |
||
瀏覽器 |
Google Chrome |
2 SSH免密登入配置
ssh-keygen cat .ssh/*.pub > .ssh/authorized_keys scp -r .ssh root@10.1.0.30:/root/ scp -r .ssh root@10.1.0.105:/root/ |
3 主機名IP對映配置
在master 機器上執行如下命令
vi /etc/hosts 192.168.217.130 hdp-0001 192.168.217.131 hdp-0002 192.168.217.132 hdp-0003 scp /etc/hosts root@hdp-0002:/etc/hosts scp /etc/hosts root@hdp-0003:/etc/hosts |
4 關閉及禁止防火牆
systemctl stop firewalld systemctl disable firewalld |
5 配置阿里yum源(可選)
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo yum makecache |
6 開啟時鐘同步
yum install -y ntp systemctl enable ntpd systemctl start ntpd |
7 關閉SELinux
vi /etc/sysconfig/selinux #修改以下內容 SELINUX=disabled |
8 安裝mysql資料庫
mysql服務安裝在master節點,也可選擇其他節點或機器。
具體步驟如下:
8.1資料庫安裝
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm yum install mysql-server [root@master ~]# service mysqld start [root@master ~]# grep "password" /var/log/mysqld.log [root@master ~]# mysql -u root -p Enter password: mysql>set global validate_password_policy=LOW; mysql> set password = password("mysql@Edmp.com"); mysql> grant all privileges on *.* to root@"%" identified by " mysql@Edmp.com" ; mysql> flush privileges; |
8.2安裝成功後,建立ambari資料庫及使用者
#進入mysql shell mysql -uroot –p #建立ambari使用者 create database ambari character set utf8 ; CREATE USER 'ambari'@'%'IDENTIFIED BY 'ambari123'; GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'%'; FLUSH PRIVILEGES; #建立hive使用者 create database hive character set utf8 ; CREATE USER 'hive'@'%'IDENTIFIED BY 'hive123'; GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%'; FLUSH PRIVILEGES; #建立oozie使用者 create database oozie character set utf8 ; CREATE USER 'oozie'@'%'IDENTIFIED BY 'oozie123'; GRANT ALL PRIVILEGES ON *.* TO 'oozie'@'%'; FLUSH PRIVILEGES; |
9 安裝JDK
9.1解壓安裝包並配置環境變數
|
9.2分發到其他伺服器
scp
-r
/opt
/java
/jdk1
.8.0_181/root@hdc
-data2
:/opt
/java
/
scp
-r
/opt
/java
/jdk1
.8.0_181/root@hdc
-data3
:/opt
/java
/
scp
/etc
/profile root@hdc
-data2
:/etc/
scp
/etc
/profile root@hdc
-data3
:/etc/
source
/etc
/profile
二、配置本地yum庫
1 服務安裝配置
yum install yum-utils createrepo yum install httpd service httpd start |
2 磁碟掛載
磁碟檔案系統可用ext4或者xfs,掛載時需新增noatime選項
mkdir /data vi /etc/fstab /dev/vdb /data xfs defaults,noatime 0 0 mkfs -t xfs /dev/vdb mount /dev/vdb /data |
3下載映象包,解壓到指定目錄
作業系統 |
版本 |
庫名稱 |
下載連結 |
CentOS 7 |
2.6.5.0 |
HDP |
http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.5.0/HDP-2.6.5.0-centos7-rpm.tar.gz |
Md5: 1775e80b7fcc16ff1f908f3d81693854 |
|||
HDP-UTILS |
http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.22/repos/centos7/HDP-UTILS-1.1.0.22-centos7.tar.gz |
||
Md5: ebf4c5519640b6a62a3def461ea66f13 |
|||
HDP-GPL |
http://public-repo-1.hortonworks.com/HDP-GPL/centos7/2.x/updates/2.6.5.0/HDP-GPL-2.6.5.0-centos7-gpl.tar.gz |
||
|
|
Md5: c1e0b4b6517142bf61f7bbdef967558f |
|
CentOS 7 |
2.6.2.0 |
Ambari |
http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.2.0/ambari-2.6.2.0-centos7.tar.gz |
Md5: 6d87af3788b8fdf4a6abaa759b1dc84e |
|||
|
|
Jdk |
jdk-8u281-linux-x64.tar.gz |
Md5: e85f591a370400c99fc314e5c43015a7 |
下載後把映象包解壓縮,並且移動到/var/www/html/hdp 目錄下;
mkdir /var/www/html/ambari tar -zxvf HDP-UTILS-1.1.0.22-centos7.tar.gz -C /var/www/html/ambari/ tar -zxvf ambari-2.6.5.0-centos7.tar.gz -C /var/www/html/ambari/ tar -zxvf HDP-2.6.5.0-centos7-rpm.tar.gz -C /var/www/html/ambari/ tar -zxvf HDP-GPL-2.6.5.0-centos7-gpl.tar.gz -C /var/www/html/ambari/ |
三、安裝配置ambari Server
1 配置ambari 的yum源(在master節點)
wget -nv http://public-repo-1.hortonworks.com/HDP/centos7/2.x/ updates/2.6.0.3/hdp.repo -O /etc/yum.repos.d/hdp.repo |
2 修改ambari.repo配置資訊
#VERSION_NUMBER=2.5.0.3-7 [ambari-2.5.0.3] name=ambari Version - ambari-2.5.0.3 baseurl=http://10.1.0.30/ambari/ambari/centos7 gpgcheck=0 gpgkey=http://10.1.0.30/ambari/ambari/centos7/2.x/updates/2.5.0.3/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins enabled=1 priority=1 |
3 執行ambari server安裝
yum install ambari-server |
4 安裝mysql-java驅動
yum install –y mysql-connector-java.noarch
找到/usr/share/java/mysql-connector-java.jar
將mysql-connector-java.jar複製到/var/lib/ambari-server/resources目錄下
cp mysql-connector-java-5.1.40.jar /var/lib/ambari-server/resources/mysql-jdbc-driver.jar |
5 ambaria初始化
#設定mysql驅動 ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar ambari-server setup |
[root@master yum.repos.d]# ambari-server setup Checking SELinux... SELinux status is 'enabled' SELinux mode is 'permissive' 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)? Adjusting ambari-server permissions and ownership... Checking firewall status... Checking JDK... [1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8 [2] Oracle JDK 1.7 + Java Cryptography Extension (JCE) Policy Files 7 [3] Custom JDK ============================================================================== Enter choice (1): 1 ………… Successfully downloaded JDK distribution to /var/lib/ambari-server/resources/jdk-8u112-linux-x64.tar.gz Installing JDK to /usr/jdk64/ Successfully installed JDK to /usr/jdk64/ Successfully downloaded JCE Policy archive to /var/lib/ambari-server/resources/jce_policy-8.zip Installing JCE policy... 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)? Completing setup... Configuring database... Enter advanced database configuration [y/n] (n)? y Configuring database... ============================================================================== Choose one of the following options: [1] - PostgreSQL (Embedded) [2] - Oracle [3] - MySQL / MariaDB [4] - PostgreSQL [5] - Microsoft SQL Server (Tech Preview) [6] - SQL Anywhere [7] - BDB ============================================================================== Enter choice (1): 3 Hostname (localhost): master.bigdata.com Port (3306): Database name (ambari): Username (ambari): Enter Database Password (bigdata): BigData123_ Configuring ambari database... Configuring remote database connection properties... WARNING: Before starting Ambari Server, you must run the following DDL against the database to create the schema: /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql (此處轉下表的資料庫操作) Proceed with configuring remote database connection properties [y/n] (y)? y Extracting system views... ambari-admin-2.6.1.5.3.jar Ambari Server 'setup' completed successfully. |
說明: |
資料庫操作
[root@master ~]# mysql -u root -p Enter password: mysql> use ambari; Database changed mysql> source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql Query OK, 0 rows affected (0.00 sec) |
6 服務啟停
啟動:ambari-server start
停止:ambari-server stop
啟動成功後可以通過瀏覽器訪問管理介面。
URL: 192.168.217.130:8080(IP為master節點IP)
使用者名稱:admin 密碼:admin
四、HDP叢集部署
1 登入ambari server 管理介面
1.在瀏覽器開啟http://192.168.217.130:8080
2.輸入使用者名稱密碼 預設admin/admin
2 進入叢集安裝嚮導
3 輸入叢集名稱
建議設定為EDMP,標信資料管理平臺簡稱
4 選擇hdp版本
點選HDP-2.6,選擇上傳檔案
在HDP/centos7/2.6.4.0-91/HDP-2.6.4.0-91.xml檔案基礎上,修改baseurl,修改完後如下:
選擇增加版本、上傳修改後的版本檔案。
增加版本完成後,直接下一步
5 確認主機列表(並上傳id_rsa檔案)
6 主機註冊、主機環境檢查
ERROR 2021-02-20 00:17:28,352 NetUtil.py:96 - EOF occurred in violation of protocol (_ssl.c:618)
ERROR 2021-02-20 00:17:28,352 NetUtil.py:97 - SSLError: Failed to connect. Please check openssl library versions.
這一步會出現一些問題,具體解決方案在第六部分安裝過程中出現的問題中查詢
7 選擇安裝部署元件
選擇安裝元件,(最小化安裝HDFS+YARN+MAPREDUCE2+Ambari Metrics+SmartSense+ZooKeeper+Hbase)不必要的元件可以暫時不安裝節省安裝時間,後續可以再新增安裝元件
8 分配服務角色
9
元件配置資訊修改
通常資料目錄修改到/data/目錄下,
有紅色資訊提示的元件表示要輸入相應的賬號密碼。
以下示例,可根據自己的實際情況配置。
9.1 HDFS
修改3個資料盤路徑
9.2 HIVE
修改後設資料庫型別及地址,填寫賬號密碼hive/hive123
9.3 oozie
填寫後設資料庫賬號密碼,修改訪問地址oozie/oozie123,路徑參考hive
9.4 zookeeper
修改資料存放路徑
9.5 ambari Metrics/ smartsence
設定賬號密碼,預設為admin/admin
附:暫時修改了以下屬性,具體配置資訊可根據實際情況後續相應修改
屬性 |
修改值 |
HDFS |
|
NameNode |
/data/hadoop/hdfs/namenode |
DataNode |
/data/hadoop/hdfs/data |
SecondaryNameNode Checkpoint directories |
/data/hadoop/hdfs/namesecondary |
Hadoop PID Dir Prefix |
/data/var/run/hadoop |
Hadoop Log Dir Prefix |
/data/var/log/hadoop |
dfs.journalnode.edits.dir |
/data/hadoop/hdfs/journalnode |
Yarn |
|
yarn.nodemanager.local-dirs |
/data/hadoop/yarn/local |
yarn.nodemanager.log-dirs |
/data/hadoop/yarn/log |
yarn.timeline-service.leveldb-state-store.path |
/data/hadoop/yarn/timeline |
yarn.timeline-service.leveldb-timeline-store.path |
/data/hadoop/yarn/timeline |
YARN Log Dir Prefix |
/data/var/log/hadoop-yarn |
YARN PID Dir Prefix |
/data/var/run/hadoop-yarn |
Mapreduce |
|
Mapreduce Log Dir Prefix |
/data/var/log/hadoop-mapreduce |
Mapreduce PID Dir Prefix |
/data/var/run/hadoop-mapreduce |
mapreduce.jobhistory.recovery.store.leveldb.path |
/data/hadoop/mapreduce/jhs |
Hive |
|
Hive Log Dir |
/data/var/log/hive |
Hive PID Dir |
/data/var/run/hive |
HBase |
|
HBase Log Dir Prefix |
/data/var/log/hbase |
HBase PID Dir |
/data/var/run/hbase |
Oozie |
|
Oozie Data Dir |
/data/hadoop/oozie/data |
Oozie Log Dir |
/data/var/log/oozie |
Oozie PID Dir |
/data/var/run/oozie |
zookeeper |
|
ZooKeeper directory |
/data/hadoop/zookeeper |
ZooKeeper Log Dir |
/data/var/log/zookeeper |
ZooKeeper PID Dir |
/data/var/run/zookeeper |
ambari-infra |
|
Metrics Collector log dir |
/data/var/log/ambari-metrics-collector |
Metrics Collector pid dir |
/data/var/run/ambari-metrics-collector |
Metrics Monitor log dir |
/data/var/log/ambari-metrics-monitor |
Metrics Monitor pid dir |
/data/var/run/ambari-metrics-monitor |
Aggregator checkpoint directory |
/data/var/lib/ambari-metrics-collector/checkpoint |
Metrics Grafana data dir |
/data/var/lib/ambari-metrics-grafana |
Metrics Grafana log dir |
/data/var/log/ambari-metrics-grafana |
Metrics Grafana pid dir |
/data/var/run/ambari-metrics-grafana |
hbase_log_dir |
/data/var/log/ambari-metrics-collector |
hbase_pid_dir |
/data/var/run/ambari-metrics-collector/ |
hbase.tmp.dir |
/data/var/lib/ambari-metrics-collector/hbase-tmp |
ambari-infra |
|
Infra Solr Client log dir |
/data/var/log/ambari-infra-solr-client |
Infra Solr log dir |
/data/var/log/ambari-infra-solr |
Infra Solr pid dir |
/data/var/run/ambari-infra-solr |
spark |
|
livy2_log_dir |
/data/var/log/livy2 |
livy2_pid_dir |
/data/var/run/livy2 |
spark_log_dir |
/data/var/log/spark2 |
spark_pid_dir |
/data/var/run/spark2 |
10 執行安裝
11 安裝成功,點選完成進入圖形介面
五 HDFS啟用HA(高可用)(暫時忽略)
1停止hbase hive相關服務,
2
在hdfs介面,點選 enable namenode ha
3 輸入namenode ha serverid
六 安裝過程中出現的問題
安裝過程中排查問題具體思路:2個路徑,第1個為安裝頁面message目錄,點選藍色進度資訊跳轉檢視;第二個ambari-server後臺日誌,具體路徑為
1)UID錯誤問題
具體報錯資訊如下
# 修改檔案:/var/lib/ambari-server/resources/stacks/HDP/2.0.6/hooks/before-ANY/files/changeToSecureUid.sh [root@manager ~]# vim /var/lib/ambari-server/resources/stacks/HDP/2.0.6/hooks/before-ANY/files/changeToSecureUid.sh function find_available_uid() { for ((i=8001; i<=9000; i++)) do grep -q $i /etc/passwd if [ "$?" -ne 0 ] then newUid=$i break fi done }
# 修改原來的 for ((i=1001; i<=2000; i++)) 為 for ((i=8001; i<=9000; i++)) # 8001,9000可以取值為暫時未使用的UID,可以使用id UID驗證UID是否被使用,找一段未使用的UID即可 |
修改完之後需要重啟ambari服務
|
2)8080埠報錯
報錯現象:
|
錯誤原因:
客戶端呼叫setupAgent.py函式, ambari-server所在IP傳參失敗,從而導致了問題的發生。
解決辦法:
找到檔案:/usr/lib/ambari-server/lib/ambari_server/setupAgent.py
手動修改ambari-server hostname
160 161 162 163 164 |
3)SSL HTTPS連線錯誤
註冊ambari-agents時failed
NetUtil.py:96 - EOF occurred in violation of protocol (_ssl.c:579)
SSLError: Failed to connect. Please check openssl library versions.
解決:如下第三個方案,/etc/ambari-agent/conf/ambari-agent.ini檔案只有執行該步驟進行註冊才生成。修改後點選“Retry Failed”按鈕,等待註冊成功進入下一步。
# 1、yum upgrade openssl 已是最新本版,未解決
# 2、vi /etc/python/cert-verification.cfg 修改 verify=disable,未解決
[ #verify=platform_default
# 3、最後解決方案 在ambari-agent的配置檔案/etc/ambari-agent/conf/ambari-agent.ini
[
|