Ambari集羣部署手冊html
(ambari離線安裝)java
Ambari 集羣管理工具node
HDP 集羣軟件存儲庫python
Mysql 元數據庫mysql
JDK 開發工具包linux
https://blog.csdn.net/microhhh/article/details/81239738redis
1.1主機名(ip在前,name在後)sql
(1)修改hostname:數據庫
hostnamectl set-hostname ambarivim
(2)vi /etc/hosts
192.168.3.212 192-168-3-212.baicheng.com
192.168.3.133 192-168-3-133.baicheng.com(建立ambari用戶,密碼ambari)
192.168.3.134 192-168-3-134.baicheng.com
192.168.3.135 192-168-3-135.baicheng.com
192.168.3.136 192-168-3-136.baicheng.com
192.168.3.137 192-168-3-137.baicheng.com
192.168.3.138 192-168-3-138.baicheng.com
192.168.3.139 192-168-3-139.baicheng.com
1.2配置FQDN
ambari節點爲例
vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=ambari
1.3防火牆
臨時關閉全部節點防火牆
systemctl disable firewalld
systemctl stop firewalld
1.4 SELinux
臨時關閉全部SELinux
setenforce 0
永久關閉:
修改配置文件須要重啓機器:
vi /etc/sysconfig/selinux
SELINUX=disabled
查看SELinux狀態:
sestatus
1.5免密
其中ambari對其餘6臺服務器以及本服務器(ambari)進行免密登陸
主節點裏root用戶登陸執行以下步驟
ssh-keygen
cd ~/.ssh/
cat id_rsa.pub >>authorized_keys
chmod 777 ~/.ssh
chmod 777 ~/.ssh/authorized_keys
先在從節點登陸root執行命令
mkdir ~/.ssh/
分發主節點裏配置好的authorized_keys到各從節點
scp /root/.ssh/authorized_keys root@192.168.200.31:/root/.ssh/authorized_keys
ssh-keygen -t rsa
ssh-copy-id 192.168.200.128
1.6時間同步
修改文件 vi /etc/locale.conf
將LANG="zh_CN.UTF-8"
修改成
LANG="en_US.UTF-8"
重啓
全部集羣上節點都須要操做
Centos 7 命令
yum install ntp
systemctl is-enabled ntpd
systemctl enable ntpd
systemctl start ntpd
查看狀態
systemctl status ntpd
安裝步驟以下:
1,執行命令以下:yum -y install ntp
2,安裝完成事後執行:vi /etc/ntp.conf
註釋掉全部server *.*.*的指向,新添加一條可鏈接的ntp服務器(百度一下ntp服務器,我選的是上海交大的)
server ntp1.aliyun.com iburst
啓動時間同步服務service ntpd start
執行命令 ntpdate -u ntp1.aliyun.com
重啓時間同步服務 service ntpd restart
經過ntpstat查看 當前時間同步狀態
synchronised to NTP server (120.25.115.19) at stratum 3
time correct to within 1043 ms
注意:
建議硬盤50G以上
192.168.80.144 ambari01 (部署Ambari-server和Mirror server)(分配1G,我這裏只是體驗過程,固然你能夠分配更多或更小)
192.168.80.145 ambari02 (部署Agent)
192.168.80.146 ambari03 (部署Agent)(分配1G,我這裏只是體驗過程,固然你能夠分配更多或更小)
192.168.80.147 ambari04 (部署Agent)
配置ip:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
jdk-8u151-linux-x64.tar.gz(推薦1.7+)
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
mysql-5.6.33-linux-glibc2.5-x86_64.tar(推薦5.6+)
https://www.mysql.com/downloads/
Python2.6/2.7(centos自帶)
HDP-UTILS-1.1.0.21-centos7.tar.gz(可做爲迅雷下載連接)
HDP-2.6.3.0-centos7-rpm.tar.gz(可做爲迅雷下載連接)
http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.3.0/HDP-2.6.3.0-centos7-rpm.tar.gz
ambari-2.6.0.0-centos7.tar.gz(可做爲迅雷下載連接)
hdp.repo
http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.3.0/HDP.repo
ambari.repo
http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.0.0/ambari.repo
本地上傳jdk-8u151-linux-x64.tar.gz到/usr/local/目錄下
cd /usr/local
解壓該文件
tar -zxvf jdk-8u151-linux-x64.tar.gz
刪除jdk-8u151-linux-x64.tar.gz壓縮包
rm -rf jdk-8u151-linux-x64.tar.gz
配置jdk環境變量
vi /etc/profile
在文件底部追加
export JAVA_HOME=/usr/local/jdk1.8.0_151
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
發送到其餘主機
scp -r /etc/profile root@namenode:/etc/profile
scp -r jdk1.8.0_151 root@datanode:`pwd`
環境變量生效(全部主機)
source /etc/profile
測試,命令行直接鍵入java,出現如下狀況及完成jdk安裝
2.1.1安裝HTTP服務器
容許http服務經過防火牆(永久)
yum install httpd -y
firewall-cmd --add-service=http
firewall-cmd --permanent --add-service=http
2.1.2 Apache服務自動啓動
添加Apache服務到系統層隨系統自動啓動
systemctl start httpd.service
systemctl enable httpd.service
yum install yum-utils createrepo -y
2.3.1建立目錄ambari
在httpd網站根目錄(/var/www/html)下建立目錄ambari
cd /var/www/html/
mkdir ambari
cd /var/www/html/ambari
mkdir HDP-UTILS
2.3.2上傳文件
上傳HDP-UTILS-1.1.0.21-centos7.tar.gz,HDP-2.6.3.0-centos7-rpm.tar.gz,ambari-2.6.0.0-centos7.tar.gz到cd /var/www/html/ambari/目錄下
2.3.3解壓
一、在/var/www/html/ambari/目錄下解壓
tar -zxvf ambari-2.6.0.0-centos7.tar.gz
tar -zxvf HDP-2.6.3.0-centos7-rpm.tar.gz
mv HDP-UTILS-1.1.0.21-centos7.tar.gz /var/www/html/ambari/HDP-UTILS/
cd /var/www/html/ambari/HDP-UTILS/
tar -zxvf HDP-UTILS-1.1.0.21-centos7.tar.gz
mv HDP-UTILS-1.1.0.21-centos7.tar.gz /var/www/html/ambari/
2.3.4查看httpd網站
使用links命令(yum install -y links)或者瀏覽器訪問
links命令:
links http://192.168.3.133/ambari/
瀏覽器:
將ambari.repo,hdp.repo上傳到/etc/yum.repos.d/目錄下
2.4.1配置ambari.repo
(url地址爲解壓文件中的路徑)
修改baseurl爲:
baseurl=http://192.168.3.133/ambari/ambari/centos7/2.6.0.0-267
修改gpgkey爲:
gpgkey=http://192.168.3.133/ambari/ambari/centos7/2.6.0.0-267/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
文件內容以下:
#VERSION_NUMBER=2.6.0.0
[ambari-2.6.0.0]
name=ambari Version - ambari-2.6.0.0
baseurl=http://192.168.200.10/ambari/ambari/centos7/2.6.0.0-267
gpgcheck=0
gpgkey=http://192.168.200.10/ambari/ambari/centos7/2.6.0.0-267/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
2.4.2配置hdp.repo
修改HDP-2.6.3.0下baseurl爲:
baseurl=http://192.168.3.133/ambari/HDP/centos7/2.6.3.0-235
修改HDP-2.6.3.0下gpgkey爲:
gpgkey=http://192.168.3.133/ambari/HDP/centos7/2.6.3.0-235/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
修改HDP-UTILS-1.1.0.21下baseurl爲:(注意,若版本號不一致,須要更改成當前版本號)
baseurl=http://192.168.3.133/ambari/HDP-UTILS/
修改HDP-UTILS-1.1.0.21下gpgkey爲:
gpgkey=http://192.168.3.133/ambari/HDP-UTILS/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
文件內容以下:
#VERSION_NUMBER=2.6.3.0-235
[HDP-2.6.3.0]
name=HDP Version - HDP-2.6.3.0
baseurl=http://192.168.200.10/ambari/HDP/centos7/2.6.3.0-235
gpgcheck=0
gpgkey=http://192.168.200.10/ambari/HDP/centos7/2.6.3.0-235/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
[HDP-UTILS-1.1.0.21]
name=HDP-UTILS-1.1.0.21
baseurl=http://192.168.200.10/ambari/HDP-UTILS/
gpgcheck=0
gpgkey=http://192.168.200.10/ambari/HDP-UTILS/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
2.4.3移動文件
(若是上傳位置不在上述地址,須要將配置完成後的ambari.repo以及hdp.repo文件移動到/etc/yum.repos.d/下)
mv ambari.repo /etc/yum.repos.d/
mv hdp.repo/etc/yum.repos.d/
依次執行如下命令:
yum clean all
yum list update
yum makecache
yum repolist
Ambari安裝會將安裝等信息寫入數據庫,建議使用本身安裝的Mysql數據庫,也能夠不安裝而使用默認數據庫PostgreSQL
安裝完成後,使用root用戶登陸執行如下命令:
3.5 安裝Mysql數據庫
Ambari安裝會將安裝等信息寫入數據庫,建議使用本身安裝的MySQL數據庫,也能夠不安裝而使用默認數據庫PostgreSQL。
Mysql數據庫安裝過程以下:
3.5.1. 下載mysql的repo源(CentOS 7.2的yum源中默認沒有mysql,要先下載mysql的repo源)
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
3.5.2. 安裝mysql57-community-release-el7-8.noarch.rpm包
rpm -ivh mysql57-community-release-el7-8.noarch.rpm --nodeps --force
安裝這個包後,會得到兩個mysql的yum repo源:
/etc/yum.repos.d/mysql-community.repo
3/etc/yum.repos.d/mysql-community-source.repo
yum -y remove mariadb-libs
3.5.3.安裝mysql
yum install mysql-server
3.5.4. 啓動mysql服務
查看MySQL服務是否已啓動:
service mysqld status
啓動服務:
systemctl start mysqld
3.5.5. 重置root密碼
MySQL5.7會在安裝後爲root用戶生成一個隨機密碼,而不是像以往版本的空密碼。 能夠安全模式修改root登陸密碼或者用隨機密碼登陸修改密碼。下面用隨機密碼方式
MySQL爲root用戶生成的隨機密碼經過mysqld.log文件能夠查找到:
grep 'temporary password' /var/log/mysqld.log
修改root用戶密碼:(MySQL的密碼策略比較複雜,過於簡單的密碼會被拒絕)
mysql -u root -p
set global validate_password_policy=0;
set global validate_password_length=4;
set PASSWORD=PASSWORD('123456');
mysql> Enter password: (輸入剛纔查詢到的隨機密碼)
mysql> update mysql.user set authentication_string=password('1234') where user='root'
mysql> exit
用root新密碼登陸:
1mysql -u root -p 1234
2.5.1建立ambari數據庫
建立ambari數據庫以及ambariuser數據庫用戶並受權
create database ambari character set utf8 ;
CREATE USER 'ambariuser'@'%'IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'ambariuser'@'%';
FLUSH PRIVILEGES;
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'%';
FLUSH PRIVILEGES;
2.5.2建立hive數據庫
建立hive數據庫以及hiveuser數據庫用戶並受權
create database hive character set utf8 ;
CREATE USER 'hiveuser'@'%'IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'hiveuser'@'%';
FLUSH PRIVILEGES;
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%';
FLUSH PRIVILEGES;
若是須要安裝其餘服務如Oozie,則建立相應的數據庫及用戶
2.5.3安裝mysql jdbc驅動
yum install mysql-connector-java -y
3.1.1安裝ambari服務
yum install -y ambari-server
3.1.2執行安裝
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)? y
3. 輸入ambari-server帳號,輸入:ambari(ambari主機上建立的用戶)
Enter user account for ambari-server daemon (root):ambari
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.8.0_151
Validating JDK on Ambari Server...done.
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): 192.168.3.212
Port (3306):
Database name (ambari):
Username (ambari): ambariuser
Enter Database Password (bigdata): 123456
Re-enter password: 123456
Configuring ambari database...
用Ambari用戶(上面設置的用戶,無密碼)登陸mysql
mysql -u ambari -p
use ambari
source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
ambari-server start
瀏覽器訪問http://192.168.3.133:8080/ 用戶名:admin 密碼:admin
4.2.1集羣配置
點擊Launch Install Wizard按鈕進行集羣配置
4.2.2設置集羣名稱
4.2.3設置HDP安裝源
選擇HDP2.6.3.0,使用Use Local Repository,選擇redhat7,Base URL內容填寫與HDP.repo中的URL地址一致
4.2.4設置集羣節點
Target Hosts中填入須要加入集羣的主機名
點擊「瀏覽」按鈕,上傳id_rsa文件(該文件須要從192.168.3.133節點中/root/.ssh/目錄中獲取)
4.2.5主機確認
K可能遇到的問題;
①查看 openssl 版本:
[root@ambari ~]# openssl version
OpenSSL 1.0.2k-fips 26 Jan 2017
[root@ambari ~]# rpm -qa | grep openssl
openssl-libs-1.0.2k-12.el7.x86_64
openssl-1.0.2k-12.el7.x86_64
若是低於 openssl-1.0.1e-16.el6.x86_64 版本,則須要更新到 openssl-1.0.1e-16.el6.x86_64 及以上版本
②查看 Python 版本:
[root@ambari ~]# python -V
Python 2.7.5
若是低於 Python 2.7 版本,則升級 Python 到 2.7 及以上版本。
③編輯 /etc/python/cert-verification.cfg 配置文件,將 [https] 節的 verify 項設爲禁用:
[root@ambari ~]# vi /etc/python/cert-verification.cfg
# Possible values are:
# 'enable' to ensure HTTPS certificate verification is enabled by default
# 'disable' to ensure HTTPS certificate verification is disabled by default
# 'platform_default' to delegate the decision to the redistributor providing this particular Python version
# For more info refer to https://www.python.org/dev/peps/pep-0493/
[https]
verify=disable
保存退出。
④編輯 /etc/ambari-agent/conf/ambari-agent.ini 配置文件,在 [security] 節部分,確保設置以下兩個值,其它值保持不變:
[root@ambari ~]# vi /etc/ambari-agent/conf/ambari-agent.ini
[security]
ssl_verify_cert=0
force_https_protocol=PROTOCOL_TLSv1_2
保存退出,重啓 ambari-agent:
[root@ambari ~]# ambari-agent restart
從新執行確認主機步驟(Confirm Hosts),便可經過確認主機並完成註冊。
禁用selinux
查看當前SELinux狀態
/usr/sbin/sestatus
在當前終端禁用SELinux
setenforce 0
永久禁用SELinux
vim /etc/selinux/config
#確認SELINUX爲禁用狀態
SELINUX=disabled
重啓計算機
sudo reboot
2、禁用PackageKit
一般在centos和redhat中爲開啓
vim /etc/yum/pluginconf.d/refresh-packagekit.conf
#確認packagekit爲禁用狀態
enabled=0
檢查UMASK
檢查系統UMASK
umask
設置當前UMASK
umask 0022
永久生效
echo umask 0022 >> /etc/profile
8、安裝Ambari-agent
在線安裝只須要運行以下命令即可
yum install ambari-agent
4.2.6選擇須要安裝的服務
4.2.7配置Slaves和Clients節點
(日誌與數據信息統一保存在/Data/work/local目錄下)
4.2.8用戶服務配置
4.2.9配置信息確認
4.2.10安裝
4.2.11完成