1. 程式人生 > >Ambari和大數據集群部署(精華)

Ambari和大數據集群部署(精華)

mas serve -a source repo security ssh root list prot

(個人經歷,如有問題請於評論區提出寶貴意見)

踩了無數的坑,終於將ambari和大數據集群部署成功了,請一定要按照步驟仔細操作,避免出現問題。

英文官方文檔鏈接:https://docs.hortonworks.com/HDPDocuments/Ambari-2.5.1.0/bk_ambari-installation/bk_ambari-installation.pdf

基礎環境
操作系統:ubuntu16
HDP: 2.6.2.14
Hdp-utils:1.1.0.21
Ambari:2.5.2.0
Jdk:1.8.0_171
Maven:apache-maven-3.5.2
Tomcat:apache-tomcat-8.5.24

重要的配置階段:
開啟root ssh登錄:
sudo passwd root 設置密碼
sudo apt-get install ssh
apt-get install vim
vi /etc/ssh/sshd_config
將PermitRootLogin without-password註釋掉
添加 PermitRootLogin yes
sudo service ssh restart

配置主機名和域名映射
vim /etc/hostname
修改主機名為master.hd
在各個從機中也這樣操作,修改主機名為 slave1.hd slave.hd 。。。(註意後綴要相同)
Ifconfig復制本地ip
Vim /etc/hosts
不要刪除任何內容,添加本地ip 和對應主機名,同時也要添加集群中其他機器的ip和主機名
從機中操作亦如此

Ssh免密登錄
sudo ssh-keygen
cd ~/.ssh
cat id_rsa.pub >> authorized_keys
ssh-copy-id [email protected]
ssh-copy-id [email protected]
ssh-copy-id [email protected]
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
試試看能不能用ssh [email protected] 登錄到其他任意從機

在集群和瀏覽器主機上啟用NTP
apt-get install ntp
update-rc.d ntp defaults

配置防火墻
sudo ufw disable
sudo iptables -X
sudo iptables -t nat -F
sudo iptables -t nat -X
sudo iptables -t mangle -F
sudo iptables -t mangle -X
sudo iptables -P INPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -P OUTPUT ACCEPT

禁用SELinux和PackageKit並檢查umask
setenforce 0
vim /etc/selinux/config (如果有)
設置SELINUX=disabled
umask 0022
echo umask 0022 >> /etc/profile

配置反向代理
apt-get install nginx
vim /etc/nginx/sites-available/default (或者/etc/nginx/nginx.conf)
在server{}中加上這句 autoindex on;

配置本地源
下載hdp hdp-utils ambari三個包並解壓到/var/www/html 下的不同文件目錄下
刪掉/var/www/html/ 下的html文件
進入hdp目錄 給與目錄下所有文件 777權限,後面安裝要用
wget -O /etc/apt/sources.list.d/ambari.list http://public-repo-1.
hortonworks.com/ambari/ubuntu16/2.x/updates/2.5.1.0/ambari.list
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com B9733A7A07513CAD
vim /etc/apt/sources.list.d/ambari.list
修改ambari倉庫的地址為本地倉庫地址http://xxxx.master/ambari/ambari/ubuntu/(註意修改)
apt-get update
apt-cache showpkg ambari-server
apt-cache showpkg ambari-agent
apt-cache showpkg ambari-metrics-assembly
apt-get install yum
vim /etc/yum/repos.d/ambari.repo
改下版本號即可

安裝部署階段
安裝ambari
apt-get install ambari-server
ambari-server setup
n
選3 並且復制粘貼jdk路徑
一路回車即可
ambari-server start
http://<主機IP>:8080
操作集群中所有機器 vim /etc/ambari-agent/conf/ambari-agent.ini
修改hostname=<主機名>
在[security]中加上force_https_protocol=PROTOCOL_TLSv1_2
Ambari-agent restart(或重啟服務器)
傻瓜式圖像化操作,不在累述
遇到問題,點Failed,或進入/var/log/xxx 查看相應日誌

Ambari和大數據集群部署(精華)