資源下載http://www.cnblogs.com/bfmq/p/6027202.html
大家都知道hadoop包含很多的組件,雖然很多都是下載后解壓簡單配置下就可以用的,但是還是耐不住我是一個懶癌晚期患者,最重要的是,沒有頁面,不夠酷炫啊,不酷炫怎么裝X?so,apache官方也是很體諒我們這些裝X達人,並且提供了一個十分簡單的安裝hadoop的工具,叫做ambari,官方出品必屬精品,那么我們就拿來用吧。
ambari可以讓你快速部署一套hadoop環境,不論你是要測試練習還是生產使用都ok,官網http://ambari.apache.org/。
ambari自身是一個分布式架構,主要由兩部分組成:Ambari Server 和 Ambari Agent;顯而易見由server控制agent來安裝對應軟件就好了,不過有一個更好的好處就是連安裝agent都可以由server來指定自動安裝,實在是殺人越貨必備良葯啊。
所有機器之間的ssh免密認證,這個大家自己做下
1 [root@linux-node1 ~]# cat /etc/hosts 2 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 3 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 4 192.168.56.11 linux-node1.example.com www.a.com linux-node1 5 192.168.56.12 linux-node2.example.com linux-node2 6 192.168.56.13 linux-node3.example.com linux-node3 7 [root@linux-node1 ~]# ssh 192.168.56.11 8 Last login: Wed Jan 24 14:40:13 2018 from 192.168.56.1 9 [root@linux-node1 ~]# logout 10 Connection to 192.168.56.11 closed. 11 [root@linux-node1 ~]# ssh 192.168.56.12 12 Last login: Wed Jan 24 14:35:36 2018 from 192.168.56.13 13 [root@linux-node2 ~]# logout 14 Connection to 192.168.56.12 closed. 15 [root@linux-node1 ~]# ssh 192.168.56.13 16 Last login: Wed Jan 24 14:35:33 2018 from 192.168.56.13 17 [root@linux-node3 ~]# logout 18 Connection to 192.168.56.13 closed.
所有機器安裝jdk,為了方便就安裝自帶的openjdk,生產環境要換成自己的jdk並設置環境變量哦
1 [root@linux-node1 ~]# yum install java-1.8.0-openjdk -y 2 [root@linux-node3 ~]# java -version 3 openjdk version "1.8.0_161" 4 OpenJDK Runtime Environment (build 1.8.0_161-b14) 5 OpenJDK 64-Bit Server VM (build 25.161-b14, mixed mode)
選擇一台主機作為server端並安裝,這里我萌用192.168.56.11,上吧!皮卡丘!
1 [root@linux-node1 yum.repos.d]# cd /etc/yum.repos.d/ 2 [root@linux-node1 yum.repos.d]# vim ambari.repo 3 [root@linux-node1 yum.repos.d]# cat ambari.repo 4 [Updates-ambari-2.2.0.0] 5 name=ambari-2.2.0.0 - Updates 6 baseurl=http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.2.0.0 7 gpgcheck=0 8 enabled=1 9 [root@linux-node1 yum.repos.d]# yum install -y ambari-server # 安裝時間稍長請耐心等待,這個包有400M,姆Q 10 [root@linux-node1 ~]# ambari-server setup # 開始安裝 11 Using python /usr/bin/python2 12 Setup ambari-server 13 Checking SELinux... # 檢測SELinux狀態 14 SELinux status is 'disabled' 15 Customize user account for ambari-server daemon [y/n] (n)? # 是否自定義用戶,不需要 16 Adjusting ambari-server permissions and ownership... 17 Checking firewall status... 18 Redirecting to /bin/systemctl status iptables.service 19 20 Checking JDK... 21 [1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8 22 [2] Oracle JDK 1.7 + Java Cryptography Extension (JCE) Policy Files 7 23 [3] Custom JDK 24 ============================================================================== 25 Enter choice (1): 3 # 選擇jdk版本,這里我們選3使用自己的jdk,不然他回去下載jdk很慢 26 WARNING: JDK must be installed on all hosts and JAVA_HOME must be valid on all hosts. 27 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. 28 Path to JAVA_HOME: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/ # 我們選擇的jdk位置,openjdk在/usr/lib/jvm/下,你要找你的版本然后這么填寫就可以了 29 Validating JDK on Ambari Server...done. 30 Completing setup... 31 Configuring database... 32 Enter advanced database configuration [y/n] (n)? # 是否打開高級的數據庫配置 33 Configuring database... 34 Default properties detected. Using built-in database. 35 Configuring ambari database... 36 Checking PostgreSQL... 37 Running initdb: This may take upto a minute. 38 Initializing database ... OK 39 40 41 About to start PostgreSQL 42 Configuring local database... 43 Connecting to local database...done. 44 Configuring PostgreSQL... 45 Restarting PostgreSQL 46 Extracting system views... 47 ambari-admin-2.2.0.0.1310.jar 48 ...... 49 Adjusting ambari-server permissions and ownership... 50 Ambari Server 'setup' completed successfully.
所以其實我們有在jdk的選擇那里需要配置下,剩下的都使用默認就可以了,現在我們可以啟動他了
1 所以其實我們有在jdk的選擇那里需要配置下,剩下的都使用默認就可以了,現在我們可以啟動他了 2 [root@linux-node1 ~]# ambari-server start 3 Using python /usr/bin/python2 4 Starting ambari-server 5 Ambari Server running with administrator privileges. 6 Organizing resource files at /var/lib/ambari-server/resources... 7 WARNING: setpgid(51389, 0) failed - [Errno 13] Permission denied 8 Server PID at: /var/run/ambari-server/ambari-server.pid 9 Server out at: /var/log/ambari-server/ambari-server.out 10 Server log at: /var/log/ambari-server/ambari-server.log 11 Waiting for server start.................... 12 Ambari Server 'start' completed successfully. 13 [root@linux-node1 ~]# ss -tln 14 State Recv-Q Send-Q Local Address:Port Peer Address:Port 15 LISTEN 0 128 *:111 *:* 16 LISTEN 0 128 *:22 *:* 17 LISTEN 0 128 *:5432 *:* 18 LISTEN 0 128 *:4505 *:* 19 LISTEN 0 128 *:4506 *:* 20 LISTEN 0 30 *:8000 *:* 21 LISTEN 0 128 :::111 :::* 22 LISTEN 0 50 :::8080 :::* # 這里,如果沒有請等待一會 23 LISTEN 0 128 :::22 :::* 24 LISTEN 0 50 :::8440 :::* 25 LISTEN 0 128 :::5432 :::* 26 LISTEN 0 50 :::8441 :::*
看到了8080端口,有經驗的小伙伴已經感覺到了,又到了我們去頁面上裝X的時刻了!默認賬號密碼都是admin


給新集群起一個名字

默認使用最新版本的Stack

集群內受操作的主機列表,需要主機名並可以解析,還有你server端私鑰,如果不是root用戶也需要更改

它會在受控機器上安裝agent包,之后我們也可以在這兩個頁面來增加刪除集群機器


這時候已經沒有問題了,但是可以看看他的警告信息,他說我得ntp沒開,因為7的系統使用chronyd,還有他說我的服務器上有一些不應該安裝的包是因為我的機器還測試了很多其他東西,如果是一個很干凈的機器就不會有這個警告,但是不重要都可以忽略,因為我們只是測試

選擇你要安裝的組件,有很多,我選幾個基本的

選擇各個組件安裝的所處機器,這個就是分的比較精細了,生產環境要好好規划哦

一個總結表

一些設置,這里要注意,有一些組件是需要你設置帳號密碼的,這個你得給人家都填寫了才能繼續,當然,填寫的帳號密碼你得記下,別鬧

再次驗證下

開始安裝,你可以看到安裝進度

經過一個相當長的時間與無數次的失敗后重試,因為要連國外的源,我萌終於成功了

任務結果匯總,有一個警告,沒關系

然后就出現了總控制台,逼格滿滿

從這里可以回退到總頁面上

然后可以對平台進行總設置,新加一些用戶設定一些權限

三台機器出現對應服務的端口號
1 [root@linux-node1 ~]# ss -tln 2 State Recv-Q Send-Q Local Address:Port Peer Address:Port 3 LISTEN 0 128 *:111 *:* 4 LISTEN 0 128 192.168.56.11:8020 *:* 5 LISTEN 0 128 192.168.56.11:50070 *:* 6 LISTEN 0 128 *:22 *:* 7 LISTEN 0 128 *:5432 *:* 8 LISTEN 0 128 *:4505 *:* 9 LISTEN 0 50 *:50010 *:* 10 LISTEN 0 128 *:4506 *:* 11 LISTEN 0 128 *:50075 *:* 12 LISTEN 0 1 *:8670 *:* 13 LISTEN 0 30 *:8000 *:* 14 LISTEN 0 128 127.0.0.1:34823 *:* 15 LISTEN 0 128 *:8010 *:* 16 LISTEN 0 128 :::45454 :::* 17 LISTEN 0 128 :::111 :::* 18 LISTEN 0 50 ::ffff:192.168.56.11:3888 :::* 19 LISTEN 0 50 :::8080 :::* 20 LISTEN 0 128 ::ffff:192.168.56.11:16020 :::* 21 LISTEN 0 50 :::37046 :::* 22 LISTEN 0 128 :::22 :::* 23 LISTEN 0 50 :::8440 :::* 24 LISTEN 0 128 :::5432 :::* 25 LISTEN 0 50 :::8441 :::* 26 LISTEN 0 50 :::13562 :::* 27 LISTEN 0 128 :::16030 :::* 28 LISTEN 0 128 ::ffff:192.168.56.11:16000 :::* 29 LISTEN 0 50 :::2181 :::* 30 LISTEN 0 128 :::8040 :::* 31 LISTEN 0 128 :::8042 :::* 32 LISTEN 0 128 :::16010 :::* 33 [root@linux-node2 ~]# ss -tln 34 State Recv-Q Send-Q Local Address:Port Peer Address:Port 35 LISTEN 0 128 *:111 *:* 36 LISTEN 0 128 *:19888 *:* 37 LISTEN 0 128 *:10033 *:* 38 LISTEN 0 128 *:22 *:* 39 LISTEN 0 128 127.0.0.1:35642 *:* 40 LISTEN 0 50 *:50010 *:* 41 LISTEN 0 128 *:50075 *:* 42 LISTEN 0 1 *:8670 *:* 43 LISTEN 0 128 *:10020 *:* 44 LISTEN 0 128 192.168.56.12:50090 *:* 45 LISTEN 0 128 *:8010 *:* 46 LISTEN 0 128 :::8141 :::* 47 LISTEN 0 128 :::45454 :::* 48 LISTEN 0 128 :::111 :::* 49 LISTEN 0 50 ::ffff:192.168.56.12:3888 :::* 50 LISTEN 0 128 :::8050 :::* 51 LISTEN 0 128 ::ffff:192.168.56.12:16020 :::* 52 LISTEN 0 128 :::22 :::* 53 LISTEN 0 128 :::8088 :::* 54 LISTEN 0 128 :::10200 :::* 55 LISTEN 0 128 :::8025 :::* 56 LISTEN 0 50 :::13562 :::* 57 LISTEN 0 128 :::8188 :::* 58 LISTEN 0 50 :::35037 :::* 59 LISTEN 0 128 :::16030 :::* 60 LISTEN 0 128 :::8030 :::* 61 LISTEN 0 50 :::2181 :::* 62 LISTEN 0 128 :::8040 :::* 63 LISTEN 0 128 :::8042 :::* 64 [root@linux-node3 rpm]# ss -tln 65 State Recv-Q Send-Q Local Address:Port Peer Address:Port 66 LISTEN 0 128 *:111 *:* 67 LISTEN 0 128 *:22 *:* 68 LISTEN 0 50 *:50010 *:* 69 LISTEN 0 128 *:50075 *:* 70 LISTEN 0 1 *:8670 *:* 71 LISTEN 0 128 127.0.0.1:45185 *:* 72 LISTEN 0 128 *:8010 *:* 73 LISTEN 0 128 :::45454 :::* 74 LISTEN 0 128 :::111 :::* 75 LISTEN 0 50 ::ffff:192.168.56.13:3888 :::* 76 LISTEN 0 50 :::39568 :::* 77 LISTEN 0 128 ::ffff:192.168.56.13:16020 :::* 78 LISTEN 0 128 :::22 :::* 79 LISTEN 0 50 :::13562 :::* 80 LISTEN 0 128 :::16030 :::* 81 LISTEN 0 50 :::2181 :::* 82 LISTEN 0 128 :::8040 :::* 83 LISTEN 0 50 ::ffff:192.168.56.13:2888 :::* 84 LISTEN 0 128 :::8042 :::*
最后還有一個小Bug,那就是如果你是直接yum沒有ambari.repo文件在ssh的時候是驗證通不過的哦,所以你需要在server端的/etc/yum.repos.d/下有一個ambari.repo
