轉:Ambari2.6.0 安裝HDP2.6.3(離線安裝)

1、下載安裝包

  由於使用在線安裝特別慢,全部的安裝包加起來有9個G左右,因此本教程是經過迅雷下載包,而後上傳到服務器,經過配置本地源的方式來實現的離線安裝。經過ambari安裝須要下載下面的三個主要包:html

HDP:http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.3.0/HDP-2.6.3.0-centos7-rpm.tar.gzjava

ambari:http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.0.0/ambari-2.6.0.0-centos7.tar.gznode

HDP-UTILS:http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos7/HDP-UTILS-1.1.0.21-centos7.tar.gzpython

注意問題:安裝的centos系統必選選擇英文版本,否則裏面有些地方爲莫名出錯mysql

2、系統環境配置

一、安裝jdk(全部機器)

通常linux自帶的jdk或者是經過yum安裝的jdk都是openjdk,可是最好是使用oracle/sun jdk,前者是開源的,缺失部分功能,後者是官方的。可是若是直接安裝oracle的jdk,第三方的依賴包不會安裝,因此最有效的額方式是經過yum安裝openjdk,並同時安裝了第三方依賴包,而後卸載openjdk,經過本身來安裝oracle的jdk,就能解決依賴問題。 linux

(1)安裝openjdk

複製代碼
[root@master ~]# yum -y install java
[root@master ~]# java -version
openjdk version "1.8.0_161"
OpenJDK Runtime Environment (build 1.8.0_161-b14)
OpenJDK 64-Bit Server VM (build 25.161-b14, mixed mode)
[root@master ~]# rpm -qa|grep java
javapackages-tools-3.4.1-11.el7.noarch
java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64
python-javapackages-3.4.1-11.el7.noarch
tzdata-java-2018d-1.el7.noarch
java-1.8.0-openjdk-headless-1.8.0.161-0.b14.el7_4.x86_64
複製代碼

(2)下載oracle

下載地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.htmlsql

選擇下載上面標紅的jdk的版本1.8.0_161 jdk-8u161-linux-x64.rpm,而後上傳到服務器數據庫

(3)卸載OpenJDK

[root@master ~]# rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.161-0.b14.el7_4.x86_64
[root@master ~]# rpm -e --nodeps java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64

(4)安裝下載好的jdk

複製代碼
[root@master ~]# rpm -ivh jdk-8u161-linux-x64.rpm 
準備中...                          ################################# [100%]
正在升級/安裝...
   1:jdk1.8-2000:1.8.0_161-fcs        ################################# [100%]
Unpacking JAR files...
    tools.jar...
    plugin.jar...
    javaws.jar...
    deploy.jar...
    rt.jar...
    jsse.jar...
    charsets.jar...
    localedata.jar...
[root@master ~]# java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
[root@master ~]# javac -version
javac 1.8.0_161
複製代碼

二、修改本機名(全部機器)

  經過vi /etc/hostname 進行修改centos

  各個節點修改爲相應的名稱,分別爲master,slave1.slave2.slave3,例瀏覽器

master

  而後重啓電腦

三、修改/etc/hosts文件(全部機器)

  這裏主要是爲了能夠實現經過名稱來查找相應的服務器

複製代碼
[root@master ~]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.12.101 master
192.168.12.102 slave1
192.168.12.103 slave2
192.168.12.104 slave3
複製代碼

  四、修改/etc/sysconfig/network(全部機器)

[root@master ~]# vi /etc/sysconfig/network
# Created by anaconda
NETWORKING=yes

   接下來就能夠經過測試一下是否能夠經過ping主機名來找到對應的服務器

複製代碼
[root@master ~]# ping slave1
PING slave1 (192.168.12.102) 56(84) bytes of data.
64 bytes from slave1 (192.168.12.102): icmp_seq=1 ttl=63 time=0.134 ms
64 bytes from slave1 (192.168.12.102): icmp_seq=2 ttl=63 time=0.132 ms
64 bytes from slave1 (192.168.12.102): icmp_seq=3 ttl=63 time=0.133 ms
64 bytes from slave1 (192.168.12.102): icmp_seq=4 ttl=63 time=0.133 ms
64 bytes from slave1 (192.168.12.102): icmp_seq=5 ttl=63 time=0.132 ms
^C
--- slave1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4000ms
rtt min/avg/max/mdev = 0.132/0.132/0.134/0.014 ms
複製代碼

五、修改文件打開限制(全部機器)

[root@master ~]# vi /etc/security/limits.conf
# End of file
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072

六、關閉防火牆(全部機器)

[root@master~]#systemctl disable firewalld
[root@master~]#systemctl stop firewalld

   除此以外

複製代碼
[root@master ~]# cat /etc/selinux/config 
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
複製代碼

七、同步時鐘

(1)安裝ntp服務(全部機器)

[root@master ~]#yum -y install ntp

(2)設置master爲主服務器,開啓nptd服務(主服務器)

[root@master ~]#vi /etc/ntp.conf

如圖:

[root@master ~]# systemctl start ntpd.service       #啓動服務
[root@master ~]# systemctl enable ntpd.service      #開機自啓動

(3)、子節點設置同步(子節點)

  主服務器開啓ntp服務器之後,子節點就不須要開啓了,由於當server與client之間的時間偏差過大時(多是1000秒),處於對修改時間可能對系統和應用帶來不可預知的問題,NTP將中止時間同步!因此若是發現NTP啓動以後時間並不進行同步時,應該考慮到多是時間差過大引發的,此時須要先手動進行時間同步!因此直接使用定時手動同步的方式就能夠了。

[root@slave1 data]# crontab -e
0-59/10 * * * * /usr/sbin/ntpdate master
crontab: installing new crontab
[root@slave1 data]# crontab -l
0-59/10 * * * * /usr/sbin/ntpdate master

八、SSH無密碼登錄(主節點)

配置master節點無密碼登陸到其餘節點,在master節點上操做

複製代碼
[root@master ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:NMVPXezqq+MPf95MtP5bzaghnvXSljcC4BH/QFCvm+I root@master
The key's randomart image is:
+---[RSA 2048]----+
|         o+. . o.|
|         o..o . .|
|        o +o . . |
|       . + oo   .|
|        S o.o  ..|
|         . .o..+o|
|         ..o=o.o=|
|        ...+oB*+=|
|         Eo.+**BO|
+----[SHA256]-----+
[root@master ~]# ssh-copy-id slave1
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'slave1 (192.168.12.102)' can't be established.
ECDSA key fingerprint is SHA256:GG4+viH+NDpVisSLMobnjEYOs171XRVUDoG85EI+mI8.
ECDSA key fingerprint is MD5:f3:bf:63:a6:89:61:c2:08:3c:7d:2a:ed:13:be:d3:ae.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@slave1's password: 
Permission denied, please try again.
root@slave1's password: 
Permission denied, please try again.
root@slave1's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'slave1'"
and check to make sure that only the key(s) you wanted were added.

[root@master ~]# ssh-copy-id slave2
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'slave2 (192.168.12.103)' can't be established.
ECDSA key fingerprint is SHA256:Yv86oeVgTcxv8FCm5FLpiEUBTAnXgH2GOkgGboyoR+8.
ECDSA key fingerprint is MD5:8c:ae:b6:c4:f1:77:1e:ab:a5:16:38:a2:d2:da:4c:af.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@slave2's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'slave2'"
and check to make sure that only the key(s) you wanted were added.

[root@master ~]# ssh-copy-id slave3
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'slave3 (192.168.12.104)' can't be established.
ECDSA key fingerprint is SHA256:GbLAIxb/anYb/TSicoZlt88DQnb331Fb0Ob5fu8xOxY.
ECDSA key fingerprint is MD5:2b:60:e4:e4:d2:37:2a:8b:fc:66:c2:e9:96:03:7e:d4.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@slave3's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'slave3'"
and check to make sure that only the key(s) you wanted were added.

[root@master ~]# ssh-copy-id master
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'master (192.168.12.101)' can't be established.
ECDSA key fingerprint is SHA256:cdz8o54DsUQzXr5vZyeSJUbVUYYZe6bGhmUPbiGW+eY.
ECDSA key fingerprint is MD5:0f:f1:23:22:29:07:eb:84:21:c9:5e:f1:31:f5:b0:77.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@master's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'master'"
and check to make sure that only the key(s) you wanted were added.
複製代碼

測試是否實現了無密碼登陸

[root@master ~]# ssh slave1 date ;ssh slave2 date;ssh slave3 date;ssh master date;
2018年 04月 23日 星期一 14:18:13 CST
2018年 04月 23日 星期一 14:18:13 CST
2018年 04月 23日 星期一 14:18:13 CST
2018年 04月 23日 星期一 14:18:13 CST

將建立的祕鑰拷貝出來,由於後面ambari安裝的時候須要上傳這個祕鑰。建立祕鑰是在隱藏文件夾/root/.ssh/下面的,因此須要先把祕鑰拷貝到可見區域,而後拷貝到電腦上。下面標紅的就是祕鑰文件

[root@master ~]# cd /root/.ssh/
[root@master .ssh]# ls
authorized_keys  id_rsa  id_rsa.pub  known_hosts
[root@master .ssh]# cp id_rsa /root/
[root@master .ssh]# ls /root/
anaconda-ks.cfg   id_rsa  jdk-8u161-linux-x64.rpm

九、其餘系統設置 (全部機器)

[root@master ~]# sudo sh -c "echo umask 0022 >> /etc/profile"

3、修改yum源,實現離線安裝

一、安裝httpd服務(主服務器)

[root@master ~]# yum -y install httpd
[root@master ~]# service httpd restart
Redirecting to /bin/systemctl restart httpd.service
[root@master ~]# chkconfig httpd on

二、將上面下載的三個包放到/var/www/html目錄下(主服務器)

複製代碼
[root@master ~]# cd /var/www/html/
[root@master html]# mkdir ambari
拷貝文件到ambari下面
[root@master html]# cd ambari/
[root@master ambari]# ls
ambari-2.6.0.0-centos7.tar.gz  HDP-2.6.3.0-centos7-rpm.tar.gz  HDP-UTILS-1.1.0.21-centos7.tar.gz
[root@master ambari]# tar -zxvf ambari-2.6.0.0-centos7.tar.gz
[root@master ambari]# tar -zxvf HDP-2.6.3.0-centos7-rpm.tar.gz 
[root@master ambari]# mkdir HDP-UTILS
[root@master ambari]# tar -zxvf HDP-UTILS-1.1.0.21-centos7.tar.gz -C HDP-UTILS
[root@master ambari]# rm -rf ambari-2.6.0.0-centos7.tar.gz HDP-2.6.3.0-centos7-rpm.tar.gz HDP-UTILS-1.1.0.21-centos7.tar.gz 
[root@master ambari]# ls
ambari  HDP  HDP-UTILS
複製代碼

如今能夠經過訪問http://192.168.12.101/ambari/查看是否能成功訪問

三、製做本地源

(1)安裝本地源製做相關工具(主服務器)

[root@master ambari]# yum install yum-utils createrepo yum-plugin-priorities -y
[root@master ambari]#  createrepo  ./

(2)修改文件裏面的源地址(主服務器)

複製代碼
[root@master ambari]# vi ambari/centos7/2.6.0.0-267/ambari.repo
#VERSION_NUMBER=2.6.0.0-267
[ambari-2.6.0.0]
name=ambari Version - ambari-2.6.0.0
baseurl=http://192.168.12.101/ambari/ambari/centos7/2.6.0.0-267
gpgcheck=1
gpgkey=http://192.168.12.101/ambari/ambari/centos7/2.6.0.0-267/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
[root@master ambari]# cp ambari/centos7/2.6.0.0-267/ambari.repo /etc/yum.repos.d/
[root@master ambari]# vi HDP/centos7/2.6.3.0-235/hdp.repo
#VERSION_NUMBER=2.6.3.0-235
[HDP-2.6.3.0]
name=HDP Version - HDP-2.6.3.0
baseurl=http://192.168.12.101/ambari/HDP/centos7/2.6.3.0-235
gpgcheck=1
gpgkey=http://192.168.12.101/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 Version - HDP-UTILS-1.1.0.21
baseurl=http://192.168.12.101/ambari/HDP-UTILS
gpgcheck=1
gpgkey=http://192.168.12.101/ambari/HDP-UTILS/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
[root@master ambari]# cp HDP/centos7/2.6.3.0-235/hdp.repo /etc/yum.repos.d/
複製代碼

上面就建立好了主機上的文件,而後能夠經過下面命令清楚一下yum的緩存就能夠了

[root@master ambari]# yum clean all
[root@master ambari]# yum makecache
[root@master ambari]# yum repolist

(3)將建立好的文件拷貝到子節點(主服務器)

複製代碼
[root@master ambari]#cd /etc/yum.repos.d
[root@master yum.repos.d]# scp ambari.repo slave1:/etc/yum.repos.d/
ambari.repo                                                                                        100%  274    16.3KB/s   00:00    
[root@master yum.repos.d]# scp ambari.repo slave2:/etc/yum.repos.d/
ambari.repo                                                                                        100%  274   115.7KB/s   00:00    
[root@master yum.repos.d]# scp ambari.repo slave3:/etc/yum.repos.d/
ambari.repo                                                                                        100%  274   608.9KB/s   00:00    
[root@master yum.repos.d]# scp hdp.repo slave1:/etc/yum.repos.d/
hdp.repo                                                                                           100%  482     1.1MB/s   00:00    
[root@master yum.repos.d]# scp hdp.repo slave2:/etc/yum.repos.d/
hdp.repo                                                                                           100%  482   969.5KB/s   00:00    
[root@master yum.repos.d]# scp hdp.repo slave3:/etc/yum.repos.d/
hdp.repo
複製代碼

4、安裝ambari-server

通過不斷的安裝,有兩種模式,一種是默認postgresql數據庫的安裝方式,這種不推薦生產環境使用,還有一種方式是使用第三方數據庫的安裝方式,下面介紹兩種安裝模式,根據我的需求選擇。建議使用自帶的postgresql來配置數據庫,這樣在後面安裝過程當中不會出現問題,若是使用其它數據庫,請參考其它教程來設置

一、默認安裝方式,使用默認數據庫PostgreSQL(不推薦生產環境使用)(主服務器)

(1)、安裝和配置ambari-server

複製代碼
[root@master yum.repos.d]# yum -y install ambari-server
[root@master yum.repos.d]# 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)? 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/java/jdk1.8.0_161
Validating JDK on Ambari Server...done.
Completing setup...
Configuring database...
Enter advanced database configuration [y/n] (n)? n
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...
Configuring PostgreSQL...
Restarting PostgreSQL
Creating schema and user...
done.
Creating tables...
done.
Extracting system views...
ambari-admin-2.6.0.0.267.jar
...........
Adjusting ambari-server permissions and ownership...
Ambari Server 'setup' completed successfully.
複製代碼

(2)、啓動ambari

[root@master ~]# ambari-server start

成功啓動後在瀏覽器輸入Ambari地址:

http://192.168.12.101:8080

二、以mysql爲數據庫安裝(主服務器)

(1)安裝mysql數據庫

[root@master ~]# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
[root@master ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm
[root@master ~]# yum install mysql-community-serve

(2)啓動mysql,設置開機啓動

[root@master ~]# service mysqld start
[root@master ~]# vi /etc/rc.local
#添加service mysqld start

(3)登陸進mysql,初始化設置root密碼

複製代碼
[root@master ~]# mysql -uroot 

設置登陸密碼
mysql> set password for 'root'@'localhost' = password('yourPassword');

添加遠程登陸用戶
mysql> grant all privileges on *.* to 'root'@'%' identified by 'yourPassword';

遠程登陸
#mysql -uroot -h ip(遠程的ip地址) -p
[root@master yum.repos.d]# yum -y install ambari-server
複製代碼

(4)登陸mysql,執行下面的語句

複製代碼
CREATE DATABASE ambari;  
use ambari;  
CREATE USER 'ambari'@'%' IDENTIFIED BY 'ambarizk123';  
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'%';  
CREATE USER 'ambari'@'localhost' IDENTIFIED BY 'ambarizk123';  
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'localhost';  
CREATE USER 'ambari'@'master' IDENTIFIED BY 'ambarizk123';  
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'master';  
FLUSH PRIVILEGES;  
source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql  
show tables;  
use mysql;  
select Host User Password from user where user='ambari';  
CREATE DATABASE hive;  
use hive;  
CREATE USER 'hive'@'%' IDENTIFIED BY 'hive';  
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%';  
CREATE USER 'hive'@'localhost' IDENTIFIED BY 'hive';  
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'localhost';  
CREATE USER 'hive'@'master' IDENTIFIED BY 'hive';  
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'master';  
FLUSH PRIVILEGES;  
CREATE DATABASE oozie;  
use oozie;  
CREATE USER 'oozie'@'%' IDENTIFIED BY 'oozie';  
GRANT ALL PRIVILEGES ON *.* TO 'oozie'@'%';  
CREATE USER 'oozie'@'localhost' IDENTIFIED BY 'oozie';  
GRANT ALL PRIVILEGES ON *.* TO 'oozie'@'localhost';  
CREATE USER 'oozie'@'master' IDENTIFIED BY 'oozie';  
GRANT ALL PRIVILEGES ON *.* TO 'oozie'@'master';  
FLUSH PRIVILEGES;
複製代碼

(5)簡歷mysql與ambari-server的鏈接

網上下載mysql-connector-java-5.1.40.jar放到root文件下

mkdir /usr/share/java
cp /root/mysql-connector-java-5.1.40.jar /usr/share/java/mysql-connector-java.jar
cp /usr/share/java/mysql-connector-java.jar /var/lib/ambari-server/resources/mysql-jdbc-driver.jar
vi /etc/ambari-server/conf/ambari.properties
添加server.jdbc.driver.path=/usr/share/java/mysql-connector-java.jar

(6)初始化設置ambari-server並啓動

複製代碼
[root@master ~]# ambari-server setup
下面是配置執行流程,按照提示操做
(1) 提示是否自定義設置。輸入:y
Customize user account for ambari-server daemon [y/n] (n)? y
(2)ambari-server 帳號。
Enter user account for ambari-server daemon (root):
若是直接回車就是默認選擇root用戶
若是輸入已經建立的用戶就會顯示:
Enter user account for ambari-server daemon (root):ambari
Adjusting ambari-server permissions and ownership...
(3)檢查防火牆是否關閉
Adjusting ambari-server permissions and ownership...
Checking firewall...
WARNING: iptables is running. Confirm the necessary Ambari ports are accessible. Refer to the Ambari documentation for more details on ports.
OK to continue [y/n] (y)?
直接回車
(4)設置JDK。輸入:3
Checking JDK...
Do you want to change Oracle JDK [y/n] (n)? y
[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
若是上面選擇3自定義JDK,則須要設置JAVA_HOME。輸入:/usr/java/jdk1.8.0_161
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/java/jdk1.8.0_131
Validating JDK on Ambari Server...done.
Completing setup...
(5)數據庫配置。選擇:y
Configuring database...
Enter advanced database configuration [y/n] (n)? y
(6)選擇數據庫類型。輸入:3
Configuring database...
==============================================================================
Choose one of the following options:
[1] - PostgreSQL (Embedded)
[2] - Oracle
[3] - MySQL
[4] - PostgreSQL
[5] - Microsoft SQL Server (Tech Preview)
[6] - SQL Anywhere
==============================================================================
Enter choice (3): 3
(7)設置數據庫的具體配置信息,根據實際狀況輸入,若是和括號內相同,則能夠直接回車。若是想重命名,就輸入。
Hostname (localhost):
Port (3306):
Database name (ambari):
Username (ambari):
Enter Database Password (bigdata):ambarizk123
Re-Enter password: ambarizk123
(8)將Ambari數據庫腳本導入到數據庫
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)?
[root@master ~]# ambari-server start
複製代碼

 三、錯誤處理

  若是出現錯誤,請注意查看日誌,根據具體的錯誤內容進行處理,默認ambari-server的日誌在/var/log/ambari-server/ambari-server.log裏面。若是在處理日誌的過程當中或者後面安裝的過程當中出現一些莫名的錯誤,能夠重置的安裝。若是上面進行的默認數據庫的配置,可使用下面的代碼重置ambari-server

[root@master ~]# ambari-server stop
[root@master ~]# ambari-server reset
[root@master ~]# ambari-server setup

  若是選擇的是第二種方式,就須要先執行上面的語句,而後手動將mysql裏面建立的數據庫進行刪除。而後再從新執行第二步的操做

複製代碼
[root@master ~]# mysql -uroot -p
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| ambari             |
| hive               |
| oozie              |
| performance_schema |
+--------------------+
5 rows in set (0.00 sec)
mysql> drop database ambari;
mysql> drop database hive;
mysql> drop database oozie;
複製代碼

  若是在安裝的過程當中出現了錯誤,又想從新安裝,能夠在ambari-server開啓的狀況下,執行下面的語句來移除已安裝的包,而後再經過不一樣的狀況選擇上面兩種方式的一種對ambari-server進行重置

python /usr/lib/python2.6/site-packages/ambari_agent/HostCleanup.py --silent

 

5、安裝配置部署HDP集羣

一、登陸

登陸界面,默認管理員帳戶登陸, 帳戶:admin 密碼:admin

二、安裝嚮導

(1)配置集羣的名字爲hadoop

(2)選擇版本並修改成本地源地址

(3)安裝配置

選擇要安裝的服務器和上傳上面教程所拷貝出來的祕鑰文件id_rsa

 (4)安裝ambari的agent,同時檢查系統問題

 若是這裏出了問題,請檢查上面全部的步驟有沒有遺漏和未設置的參數。同時在從新修改了配置之後,最好是重置ambari-server來從新進行安裝

[root@master ~]# # ambari-server stop    
[root@master ~]# # ambari-server reset   #重置命令
[root@master ~]# # ambari-server setup   #從新設置
[root@master ~]# # ambari-server start

 (5)選擇要安裝的服務

 (6)選擇分配服務

(7)選擇

建議nodemanager、regionserver、client全都勾選上,第一個datanode根據主機的磁盤容量選擇。

(8)根據提示修改一些錯誤,注意hive和oozie的數據庫配置問題。若是最開始初始化ambari-server的時候使用的是默認配置,這裏就最好使用new的方式,若是使用的是New MySQL Database ,這須要選擇Existing MySQL / MariaDB Database ,而後測試一下是否能鏈接上

(9)接下來就是安裝了,若是經過了最好,沒有經過須要排查日誌,看具體哪一個地方出錯。若是實在處理不了一些問題,能夠根據上面的錯誤處理進行重置安裝。

相關文章
相關標籤/搜索