3、制作本地源
(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
四、安裝ambari-server
經過不斷的安裝,有兩種模式,一種是默認postgresql數據庫的安裝方式,這種不推薦生產環境使用,還有一種方式是使用第三方數據庫的安裝方式,下面介紹兩種安裝模式,根據個人需求選擇。建議使用自帶的postgresql來配置數據庫,這樣在后面安裝過程中不會出現問題,如果使用其它數據庫,請參考其它教程來設置
1、默認安裝方式,使用默認數據庫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
2、以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
復制代碼
?3、錯誤處理
如果出現錯誤,請注意查看日志,根據具體的錯誤內容進行處理,默認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
mongodb安裝
?
?