centos7 離線安裝Ambari


准備工作

  • 新下載的centos7
  • 安裝 createrepo,用於制作源
yum install createrepo
  • 安裝java (推薦 java 1.7以上版本,如果有,則跳過此步驟)
yum install java
  • 安裝高版本的openssl(各個host都需要安裝,否則在ambari中安裝服務的時候,會注冊失敗)
yum install openssl
  • 安裝ncredhat-lsbhadoophbase都有依賴)
yum install nc
yum install redhat-lsb
  • 安裝 gccpython -devel,python-libs 這類要成套
yum install gcc
yum install python-devel
yum install python-libs

 

配置環境

  • httpd服務,服務根目錄是 /var/www/html
vi /etc/httpd/conf/httpd.conf

啟用ServerName:把 #ServerName www.example.com:80 修改為 ServerName hostname:80

修改訪問權限:

<Directory />

   Options FollowSymLinks

   AllowOverride None

   Order allow,deny

   Allow from all

</Directory>

將紅色部分的Deny修改為Allow

 

  • 關閉SELinux服務,關閉防火牆,啟動httpd服務
chkconfig iptables off
service firewalld stop    # 如果是centos6 命令是:service iptables stop
setenforce 0 service httpd start

打開瀏覽器,輸入:http://hostname:80,如果能正確打開網頁,則服務正常啟動 

 

下載服務包

  • 下載HDP HDP-UTILS: 
wget -nv http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.3.0.0/hdp.repo -O /etc/yum.repos.d/hdp.repo
#同步
Yum repolist
reposync -r HDP-UTILS-1.1.0.20
reposunc -r HDP-2.3.0.0
  • 下載Amabri
wget -nv http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.1.2/ambari.repo -O /etc/yum.repos.d/ambari.repo
#同步
yum repolist
reposync -r Updates-ambari-2.1.2

 

制作離線源

把同步的HDP-2.3.0.0、 HDP-UTILS-1.1.0.20Updates-ambari-2.1.2,移動到 /var/www/html目錄,分別進入三個目錄,執行 createrepo ./

/var/www/html目錄下,分別執行

mkdir -p ambari-2.1.2/centos7
mkdir -p /var/www/html/HDP/centos7/2.x/2.3.0.0
mkdir -p HDP-UTILS-1.1.0.20/repos/centos7

把同步下來的包分別移動到對應的目錄

然后分別執行

createrepo /var/www/html/ambari-2.1.2/centos7
createrepo /var/www/html/HDP/centos7/2.x/2.3.0.0
createrepo /var/www/html/HDP-UTILS-1.1.0.20/repos/centos7

這樣,離線源做好了

 

編寫repo

備份/etc/yum.repo.d/下的所有文件,使yum安裝就無法找到外網的源

mkdir bak
mv /etc/yum.repo.d/* bak/

創建文件 ambari.repo,寫入內容:

 

#VERSION_NUMBER=2.1.2-377
[Updates-ambari-2.1.2]
name=ambari-2.1.2 - Updates
baseurl=http://<hostname>/ambari-2.1.2/centos7
gpgcheck=0
enabled=1

[HDP-2.3.0.0]
name=HDP Version - HDP-2.3.0.0
baseurl=http://<hostname>/hdp/HDP/centos7/2.x/updates/2.3.0.0
gpgcheck=0
enabled=1
 

[HDP-UTILS-1.1.0.20]
name=HDP Utils Version - HDP-UTILS-1.1.0.20
baseurl=http://<hostname>/HDP-UTILS-1.1.0.20/repos/centos7
gpgcheck=0
enabled=1

保存,然后執行

yum clean all
yum makecache

注意:紅色加粗部分的<hostname> ,需要替換成提供httpd和離線鏡像的主機的IP或者hostname

 

安裝

然后開始安裝ambari-server

PS:安裝過程中提示依賴 Postgresql-server,則先需要安裝postgresql-server,可以依照前面的下載鏡像,制作鏡像源來提供下載

Ambari-server setup

PS:需要設置JAVA_HOME的路徑,或者下載安裝(依照前面的下載鏡像,制作離線鏡像源)

 

執行:

Ambari-server start

 start 成功后,即可在網頁上打開 ambari的web UI來安裝hadoop集群。

如果遇到錯誤,請查看 /var/log/ambari-server/ambari-server.log中查找出錯原因。

 

安裝 hadoop

1,配置好hostip的映射

2,無密登錄,把操作ambari-server的web UI的機器的rsa公鑰發給要安裝集群的各個主機,此處我假設操作網頁的機器是PC0,要安裝服務的是PC1,PC2,PC3

PC0: 

ssk-keygen -t rsa

scp ~/.ssh/id_rsa.pub root@PC1:~/

scp ~/.ssh/id_rsa.pub root@PC2:~/

scp ~/.ssh/id_rsa.pub root@PC3:~/

 

PC1,PC2,PC3:

#############################################################

修改/etc/ssh/sshd_config,確保一下服務開啟

RSAAuthentication yes

PubkeyAuthentication yes

AuthorizedKeysFile      .ssh/authorized_keys

#############################################################

#ssk-keygen -t rsa

cat ~/id_rsa.pub >> ~/.ssh/authorized_keys

 

3,啟動 ntpd

service ntpd start

4,關閉 iptables

service iptables stop

5,關閉LinuxTHP服務,需要重啟

#centos6
vi /etc/grub.conf,添加 transparent_hugepage=never

#centos7:
vi /etc/default/grub
在有CMDLINE一行添加 transparent_hugepage=never
grub2-mkconfig -o /boot/grub2/grub.cfg
systemctl disable tuned

重啟之后,用下面的命令檢查:

cat /sys/kernel/mm/redhat_transparent_hugepage/enabled

有 [never]則表示THP被禁用

6,打開網頁hostname:8080,用admin:admin登錄,按照網頁提示,開始安裝hadoop集群

 

安裝遇到的問題

opensslNetUtil.py 無法注冊,需要yum upgrade openssl

Install,Start and Test這一步,等待時間長,可能出現比較多的錯誤:

1App Timeline server安裝出錯,retry解決;

2Heartbeat lost for the host錯誤,檢查出錯節點的ambari-agent是否停止,ambari-angentpython腳本運行的,可能遇到沒有捕捉到的異常,導致進程crash或者停止了;


免責聲明!

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



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