cluster-01 : yum server
cluster-02:MySQL server,ambari server
安裝思路:
在生產(chǎn)環(huán)境中,應(yīng)該是沒有外網(wǎng)鏈接的環(huán)境,或者做了外網(wǎng)隔離,因此在離線環(huán)境下搭建集群很有價(jià)值。在內(nèi)網(wǎng)集群中搭建yum服務(wù)器,安裝ambari和集群,是一種比較好的解決思路。
安裝步驟:
安裝過程:
(一)搭建Yum源服務(wù)器
1)安裝http server
在cluster-01上安裝apaceh http服務(wù)。
檢查是否已經(jīng)安裝apache http服務(wù)
[root@cluster-01 ~]$ which httpd
如果沒有出現(xiàn)目錄信息,則說明沒有安裝。
[root@cluster-01 ~]$ sudo yum install httpd
安裝成功之后,apache工作目錄默認(rèn)在/var/www/html。
配置
檢查端口是否占用,apache http服務(wù)使用80端口
[root@cluster-01 ~]$ netstat -nltp | grep 80
如果有占用情況,安裝完畢之后需要修改apache http服務(wù)的端口號(hào):
[root@cluster-01 ~]$ sudo vi /etc/httpd/conf/httpd.conf
修改監(jiān)聽端口,Listen 80為其他端口。
啟動(dòng)
[root@cluster-01 ~]$ sudo service httpd start
可以在瀏覽器中查看http://cluster-01 看到apache server的一些頁面信息,表示啟動(dòng)成功。
2)添加rpm包到repository中
添加HDP 相關(guān)rpm包
下載HDP2.2.0的包
http://public-repo-1.hortonworks.com/HDP/centos6/HDP-2.2.0.0-centos6-rpm.tar.gz
http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6/HDP-UTILS-1.1.0.20-centos6.tar.gz
解壓之后,會(huì)有HDP,HDP-UTILS-1.1.0.17的目錄生成。
下載ambari的包
此處我們使用自己編譯好的
ambari-server-1.6.1.1.noarch.rpm
ambari-agent-1.6.1.1.noarch.rpm
注意:如果不使用己編譯好的rpm包,也可以使用官網(wǎng)下載的
http://public-repo-1.hortonworks.com/ambari/centos6/ambari-1.6.1-centos6.tar.gz
將這些包復(fù)制到/var/www/html/centos-6/
[root@cluster-01 html]# ll /var/www/html/
說明:
ambari目錄:包含ambari-server,ambari-agent,ambari-log4j等rpm包
HDP目錄:包含Hadoop的生態(tài)圈的組件,比如hdfs,Hive,hbase,mahout等
HDP-UTILS-1.1.0.17目錄:包含HDP平臺(tái)所包含的工具組件等,比如nagios,ganglia,puppet等
3)創(chuàng)建Yum repository
在本地安裝createrepo軟件。
檢查是否已經(jīng)安裝:
[root@cluster-01 ~]$ which createrepo
如果出現(xiàn)在具體的目錄,則說明已經(jīng)安裝
安裝:
[root@cluster-01 ~]$ sudo yum install createrepo
創(chuàng)建repository:
[root@cluster-01 ~]$ sudo createrepo /var/www/html/centos-6/
修改客戶端Yum源配置
在ambari安裝的節(jié)點(diǎn)做如下操作:
將/etc/yum.repos.d下的所有repo做備份,然后刪除,創(chuàng)建一個(gè)ambari.repo,寫入以下內(nèi)容:
[root@cluster-01 ~]# vi /etc/yum.repos.d/ambari.repo
[ambari-1.x]
name=Ambari 1.x
baseurl=http://public-repo-1.hortonworks.com/ambari/centos6/1.x/GA
gpgcheck=1
gpgkey=http://public-repo-1.hortonworks.com/ambari/centos6/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=0 (注意,不啟用)
priority=1
[Updates-ambari-1.6.1]
name=ambari-1.6.1 - Updates
baseurl=http://cluster-01/ambari/centos6/1.x/updates/1.6.1
enabled=1
priority=1
注意:
baseurl=http://<your server IP>/ambari/centos6/1.x/updates/1.6.1
ambari/centos6/1.x/updates/1.6.1與yum repository地址相對(duì)應(yīng)??梢栽跒g覽器中,
查看這個(gè)地址http://cluster-01/ambari/centos6/1.x/updates/1.6.1
清除緩存:
[root@cluster-01 ~]$ sudo yum clean all
測(cè)試下:
[root@cluster-01 ~]$ sudo yum repolist
如果出現(xiàn)倉庫的名稱等輸出,則說明配置成功。
如圖所示,出現(xiàn)對(duì)應(yīng)的repository即可。
(二)安裝MySQL服務(wù)
1)安裝
通過yum安裝mysql:
[root@cluster-02 ~]$ sudo yum install mysql-server
啟動(dòng)mysql服務(wù)
[root@cluster-02 ~]$ sudo service mysqld start
安裝MySQL JDBC Connector:
[root@cluster-02 root]$ sudo yum install mysql-connector-Java
2)配置
1)啟動(dòng)mysql服務(wù)
[root@cluster-02 ~]# service mysqld start
2)為root用戶設(shè)置新密碼等初始化工作
[root@cluster-01 ~]$ sudo /usr/bin/mysql_secure_installation
3)為ambari創(chuàng)建數(shù)據(jù)庫,配置相應(yīng)用戶和權(quán)限
[root@cluster-02 ~]# mysql -u root –p
mysql> create database ambari;
Query OK, 1 row affected (0.00 sec)
mysql> use ambari;
Database changed
mysql>
CREATE USER 'ambari'@'%' IDENTIFIED BY 'ambari';
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'%';
CREATE USER 'ambari'@'localhost' IDENTIFIED BY 'ambari';
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'localhost';
CREATE USER 'ambari'@'cluster-02' IDENTIFIED BY 'ambari';
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'cluster-02';
FLUSH PRIVILEGES;
3)啟動(dòng)
mysql設(shè)置為開機(jī)自啟動(dòng)
[root@cluster-05 root]$ sudo chkconfig mysqld on
[root@cluster-05 root]$ sudo chkconfig –list
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
1)安裝
yum安裝,所有依賴yum自動(dòng)下載,只需要執(zhí)行命令即可。
[root@cluster-02 root]# yum install ambari-server
出現(xiàn)Complete! 則可
2)配置
[root@cluster-02 root]# ambari-server setup
Daemon運(yùn)行的賬號(hào)設(shè)置
Customize user account for ambari-server daemon [y/n] (n)?
輸入:y
Enter user account for ambari-server daemon (root):
輸入:root
檢查防火墻是否關(guān)閉
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)?
輸入:y
檢查JDK
Checking JDK...
[1] - Oracle JDK 1.7 + Java Cryptography Extension (JCE) Policy Files 7
[2] - Oracle JDK 1.6 + Java Cryptography Extension (JCE) Policy Files 6
[3] - Custom JDK
==============================================================================
Enter choice (1):
輸入:3
輸入:/usr/local/jdk1.7.0_51/ (jdk的home,根據(jù)情況輸入)
Choose one of the following options:
[1] - PostgreSQL (Embedded)
[2] - Oracle
[3] - MySQL
[4] - PostgreSQL
==============================================================================
Enter choice (1):
輸入:3
Hostname (localhost):
Port (3306):
Database Name (ambari):
Username (ambari):
輸入:(什么也不輸入,直接“回車”)
Enter Database Password (cluster):
Re-enter password:
輸入: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)?
輸入:y
注意,此刻需要切換到mysql中執(zhí)行相應(yīng)腳本操作。
需要登錄到mysql數(shù)據(jù)庫,執(zhí)行以下腳本Ambari-DDL-MySQL-CREATE.sql
[root@cluster-02 ~]# mysql -u root –p
mysql> use ambari;
Database changed
mysql> source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sq
執(zhí)行腳本,成功。
驗(yàn)證腳本是否初始化成功,出現(xiàn)以下table列表。
mysql> show tables;
+-------------------------------+
| Tables_in_ambari |
+-------------------------------+
| ClusterHostMapping |
| QRTZ_BLOB_TRIGGERS |
| QRTZ_CALENDARS |
| QRTZ_CRON_TRIGGERS |
| QRTZ_FIRED_TRIGGERS |
| QRTZ_JOB_DETAILS |
| QRTZ_LOCKS |
3)啟動(dòng)
[root@cluster-02 root]# ambari-server start
Using Python /usr/bin/python2.6
Starting ambari-server
Ambari Server running with 'root' privileges.
Organizing resource files at /var/lib/ambari-server/resources...
Server PID at: /var/run/ambari-server/ambari-server.pid
Server out at: /var/log/ambari-server/ambari-server.out
Server log at: /var/log/ambari-server/ambari-server.log
Waiting for server start....................
Ambari Server 'start' completed successfully.
啟動(dòng)成功。
登錄 http://<Your Server IP>:8080
參考資料:
Ambari安裝文檔
https://cwiki.apache.org/confluence/display/AMBARI/Installation+Guide+for+Ambari+1.6.1
Hortonworks公司(Ambari發(fā)揮到極致)
原創(chuàng)文章,歡迎轉(zhuǎn)載,轉(zhuǎn)載請(qǐng)標(biāo)明出處 http://blog.csdn.NET/shifenglov/article/details/41831983
聯(lián)系客服