大數(shù)據(jù)平臺(tái),涉及到很多軟件產(chǎn)品,如果剛剛?cè)胄衕adoop,直接下載軟件包,手動(dòng)配置文件的方式,并沒有那么直觀和容易。
大城ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場(chǎng)景,ssl證書未來(lái)市場(chǎng)廣闊!成為成都創(chuàng)新互聯(lián)的ssl證書銷售渠道,可以享受市場(chǎng)價(jià)格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:18982081108(備注:SSL證書合作)期待與您的合作!
Ambari提供了一個(gè)選擇,圖形化安裝和管理hadoop集群
Ambari公司就不介紹了,Ambari軟件很直觀,但是實(shí)際安裝感受并不好。反倒不如自己安裝可控。出錯(cuò)/失敗之后,“retry”似乎是唯一的辦法。
現(xiàn)在我們開始著手安裝了,安裝過(guò)程中,我會(huì)介紹我遇到的坑,和如何再次爬出來(lái)。
1. 首先登陸官方頁(yè)面
https://docs.hortonworks.com/index.html
2. 選擇需要的版本
3. 點(diǎn)擊installation
4. 選擇Install Ambari
5. 然后進(jìn)入文檔頁(yè)面
官方安裝步驟,注意,選擇你需要安裝的版本的安裝文檔
https://docs.hortonworks.com/HDPDocuments/Ambari-2.4.2.0/bk_ambari-installation/content/download_the_ambari_repo_lnx6.html
6. 根據(jù)上面的步驟,就可以進(jìn)入到配置yum 源頭,由于源頭在海外,速度超慢,我先將軟件包下載到本地。
wget -nv http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.4.2.0/ambari.repo -O /etc/yum.repos.d/ambari.repo yum repolist yum install --downloadonly ambari-server --downloaddir=/tmp/ yum install --downloadonly HDP-2.5.0.0 --downloaddir=/tmp/ yum install --downloadonly HDP-2.5.* --downloaddir=/tmp/ Update on 2018-5-13 yum源有問(wèn)題了,wget下載地址: wget http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos6/HDP-UTILS-1.1.0.21-centos6.tar.gz wget http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.5.0.0/HDP-2.5.0.0-centos6-rpm.tar.gz [root@db_monitor]# ll -rw-r--r-- 1 root root 5996696005 Aug 27 2016 HDP-2.5.0.0-centos6-tars-tarball.tar.gz -rw-r--r-- 1 root root 833424206 Oct 26 23:09 HDP-UTILS-1.1.0.21-centos6.tar.gz
7.下載到本地之后,在一個(gè)服務(wù)器上,創(chuàng)建一個(gè)HTTP服務(wù),用來(lái)后面的安裝
yum install httpd -y # service httpd restart # chkconfig httpd on
將下載的HDP軟件包放入到/var/www/html/目錄下
即可通過(guò)網(wǎng)頁(yè)訪問(wèn)了
準(zhǔn)備環(huán)節(jié)完成了,開始安裝了
8. 配置節(jié)點(diǎn)的ssh免密登陸,只在安裝ambari的服務(wù)器上可以訪問(wèn)其他節(jié)點(diǎn)即可。
$ ssh-keygen -t rsa -f ~/.ssh/id_rsa
三個(gè)回車即可
拷貝密鑰到全部節(jié)點(diǎn)即可(只有ambari訪問(wèn)其他server不需要密碼,反向訪問(wèn)是需要密碼的)
ssh-copy-id server2 ssh-copy-id server3 ssh-copy-id server4
9. 配置ambaris,先關(guān)閉selinux(我使用到ansible,可以通過(guò)修改配置文件來(lái)禁用)
ansible all -m selinux -a 'state=disabled'
10.關(guān)閉防火墻
ansible all -m service -a 'name=iptables state=stopped enabled=off'
11.安裝JDK,ambari安裝的過(guò)程,可以自動(dòng)安裝,但是速度比較慢。建議自行安裝。需要在全部節(jié)點(diǎn)都安裝
下載JDK(內(nèi)網(wǎng)地址)
wget http://10.21.xx.xx/deploy/jdk1.7.0_79.tar.gz
安裝JDK,全部節(jié)點(diǎn)都要安裝
#tar -xzvf jdk1.7.0_79.tar.gz -C /usr/local
添加下面信息到.bash_profile
export JAVA_HOME=/usr/local/jdk1.8.0_144 export JRE_HOME=/usr/local/jdk1.8.0_144/jre export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH export PATH=$JAVA_HOME/bin:$PATH source /etc/profile
12. 現(xiàn)在才開始正式ambaris安裝
(注意:如果選擇自行安裝jdk,并且后續(xù)需要使用kerberos認(rèn)證的話,還是需要JCE的。不然就無(wú)法正常連接KDC的。這是我后面遇到問(wèn)題才發(fā)現(xiàn)的。而且oracle官網(wǎng),只能下載1.8版本的JCE。1.7及以下,需要metalink賬號(hào)才能下載。所以,如果網(wǎng)速可以的情況下,建議直接選擇1、2進(jìn)行安裝JDK)
[root@ip-10-21-23-29 ambari]# ambari-server setup Using python /usr/bin/python Setup ambari-server Checking SELinux... SELinux status is 'disabled' 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): 3 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/jdk1.7.0_79 Validating JDK on Ambari Server...done. Completing setup... Configuring database... Enter advanced database configuration [y/n] (n)? -----如果不希望安裝默認(rèn)的postgres數(shù)據(jù)庫(kù),這里要選Y 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... Connecting to local database...done. Configuring PostgreSQL... Restarting PostgreSQL Extracting system views... ......ambari-admin-2.4.1.0.22.jar ....... Adjusting ambari-server permissions and ownership... Ambari Server 'setup' completed successfully.
14. 啟動(dòng)ambari
[root@ip-10-21-23-29 ambari]# 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... No errors were found. Ambari database consistency check finished Server PID at: /var/run/ambari-server/ambari-server.pid Server out at: /data1/log/ambari-server/ambari-server.out Server log at: /data1/log/ambari-server/ambari-server.log Waiting for server start.................... Ambari Server 'start' completed successfully.
15. 但是現(xiàn)在,網(wǎng)頁(yè)是無(wú)法打開的,安裝httpd服務(wù)
[root@ip-10-21-23-29 ambari]# service httpd status httpd: unrecognized service
需要安裝httpd
[root@ip-10-21-23-29 ambari]# yum install httpd [root@ip-10-21-23-29 ambari]# service httpd status httpd is stopped [root@ip-10-21-23-29 ambari]# service httpd start Starting httpd: [ OK ]
16. 頁(yè)面安裝開始,網(wǎng)上很多人都寫過(guò)如何安裝的,我只是將比較重點(diǎn)的部分截圖
這里需要選擇前面已經(jīng)準(zhǔn)備好的HTTP連接,路徑參考如下
HDP Base URL | http:// |
HDP-UTILS Base URL | http:// |
17. 填入主機(jī)名,一定將完整的主機(jī)名填入,包括后綴。不能用IP代替。這里就要注意/etc/hosts是否都正常解析
18. 安裝ambari的agent,如果遇到失敗,選擇失敗的條目,可以“retry”
19. 即使成功,下面如果有warning,也需要解決,跳過(guò)絕對(duì)不是明智的選擇。 我就遇到點(diǎn)問(wèn)題
通過(guò)下面命令,關(guān)閉THP,然后Rerun checks,確保都解決掉
echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled echo never > /sys/kernel/mm/redhat_transparent_hugepage/defrag echo "transparent_hugepage=never" >> /etc/grub.conf
20. 問(wèn)題全解決之后,開始安裝
21. 也許你在想,這么快就完成了?那你錯(cuò)了。我被折磨了一周,才見到下面這個(gè)界面。而且,你是不是覺得,我的界面過(guò)于簡(jiǎn)單?是的,我只部署了zookeeper和HDFS。因?yàn)?,錯(cuò)了太多次了。我只能嘗試從最簡(jiǎn)單的開始安裝。減少出問(wèn)題的概率。
22. 成功之后,可以通過(guò)add service的方式,逐步增加你需要的資源
23. 增加service的過(guò)程
24. 看看吧,這個(gè)就是安裝成功的界面。看到它,不容易啊。
下面就和大家抱怨一下Ambari的種種不便吧。
失敗的,基本只能retry,甚至不能重新再安裝。之前已經(jīng)安裝的服務(wù),會(huì)影響到你下次的安裝。
我由于無(wú)法忍受種種失敗,打算換個(gè)名字重新安裝,但是上次安裝失敗的軟件還在,無(wú)法重新安裝。只能先卸載之前已經(jīng)安裝的service。
那么問(wèn)題來(lái)了,Ambari竟然不能卸載!不能卸載!不能卸載! 重啟服務(wù),重啟主機(jī),統(tǒng)統(tǒng)無(wú)法跳過(guò)。依然很執(zhí)著的停在那個(gè)錯(cuò)誤的頁(yè)面。
終于在參考別人的blog之后,找到命令刪除的方式
1. 查詢資源
curl -u admin:admin -H “X-Requested-By: ambari” -X GET http://10.21.23.29:8080/api/v1/clusters/beta_eu/services/
2. 刪除資源
curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE http://10.21.23.29:8080/api/v1/clusters/beta_eu/services/KAFKA
3. 如果刪除失敗,先stop在刪除
#curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE http://10.21.23.29:8080/api/v1/clusters/beta_eu/services/APPCONFIGURATION { "status" : 500, "message" : "org.apache.ambari.server.controller.spi.SystemException: An internal system exception occurred: Cannot remove beta_eu/APPCONFIGURATION. One or more host components are in a non-removable state."
4. 停止service
[root@ip-10-21-23-29 ~]# curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop Service"},"Body":{"ServiceInfo":{"state":"INSTALLED"}}}' 10.21.23.29:8080/api/v1/clusters/beta_eu/services/APPCONFIGURATION { "href" : "http://10.21.23.29:8080/api/v1/clusters/beta_eu/requests/24", "Requests" : { "id" : 24, "status" : "Accepted" }
5. 刪除service
[root@ip-10-21-23-29 ~]#curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE http://10.21.23.29:8080/api/v1/clusters/beta_eu/services/APPCONFIGURATION
6. 再次檢查,已經(jīng)沒有service了
[root@ip-10-21-23-29 ~]# curl -u admin:admin -H “X-Requested-By: ambari” -X GET http://10.21.23.29:8080/api/v1/clusters/beta_eu/services/ curl: (6) Couldn't resolve host 'ambari”' { "href" : "http://10.21.23.29:8080/api/v1/clusters/beta_eu/services/", "items" : [ ]
參考鏈接
http://blog.csdn.net/chengyuqiang/article/details/61195805