hadoop集群ambari搭建(1)之ambari-server安裝
Apache Ambari是一種基于Web的工具,支持Apache Hadoop集群的供應、管理和監控。Ambari目前已支持大多數Hadoop組件,包括HDFS、MapReduce、Hive、Pig、 Hbase、Zookeper、Sqoop和Hcatalog等。
Apache Ambari 支持HDFS、MapReduce、Hive、Pig、Hbase、Zookeper、Sqoop和Hcatalog等的集中管理。也是5個頂級hadoop管理工具之一。
Ambari主要取得了以下成績:
通過一步一步的安裝向導簡化了集群供應。
預先配置好關鍵的運維指標(metrics),可以直接查看Hadoop Core(HDFS和MapReduce)及相關項目(如HBase、Hive和HCatalog)是否健康。
支持作業與任務執行的可視化與分析,能夠更好地查看依賴和性能。
通過一個完整的RESTful API把監控信息暴露出來,集成了現有的運維工具。
用戶界面非常直觀,用戶可以輕松有效地查看信息并控制集群。
Ambari使用Ganglia收集度量指標,用Nagios支持系統報警,當需要引起管理員的關注時(比如,節點停機或磁盤剩余空間不足等問題),系統將向其發送郵件。
此外,Ambari能夠安裝安全的(基于Kerberos)Hadoop集群,以此實現了對Hadoop 安全的支持,提供了基于角色的用戶認證、授權和審計功能,并為用戶管理集成了LDAP和Active Directory。
1.安裝centos 6.5操作系統
每一個操作系統都配置了三塊網卡,一塊net,一塊host only,一塊橋接。除了net轉發動態獲取IP,其他的網卡IP都是靜態配置的。
系統版本:
CentOS release 6.5 (Final)
</div>
CPU:
model name : Intel(R) Core(TM) i5-4460 CPU @ 3.20GHz
stepping : 3
cpu MHz : 3192.620
cache size : 6144 KB
clflush size : 64
cache_alignment : 64
address sizes : 42 bits physical, 48 bits virtual
內存
MemTotal: 1004412 kB 1G
</div>
</div>
硬盤
總容量 20G
節點名稱
</td>
|
IP1
</td>
| IP2 |
備注
</td>
</tr>
| |||||||||||
hadoop1
</td>
|
192.168.253.188
</td>
|
動態聯網
</td>
|
root/123456/192.168.1.122 橋接
</td>
</tr>
| |||||||||||
hadoop2
</td>
|
192.168.253.189
</td>
|
動態聯網
</td>
|
| |||||||||||
hadoop3
</td>
|
192.168.253.190
</td>
|
動態聯網
</td>
|
</div> 2.ssh免秘鑰登錄創建用戶hadoop
[root@hadoop3 ~]# useradd hadoop
[root@hadoop3 ~]# passwd hadoop
</div>
修改密碼
所有機器都使用同樣的密碼最好。
使用hadoop用戶,命令如下 ssh-keygen -t rsa 生成rsa加密的密鑰 cp id_rsa.pub authorized_keys copy文件 cat id_rsa.pub>>authorized_keys 將其他的秘鑰追加到這一個文件中,然后分發給所有機器 [hadoop@hadoop1 .ssh]$ cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAqxuCo78OdD/GIgphhLdKFA+vop4AnyiBaNDYlUE6PPwzqoBZVmmGPjrBV+rM/GQkZ1xrDCabKywvcgz+YW5vmo511bZ9ZBXQXck/zSkHcf84YXZo56dcFd00qpbFA1y/5KhtRn4J1REhHRJFYx99ZlBr9miNnGQfZeEYJsNANzTwJGU9Vc5r5Qvkhi9bJ70THkP0rMm2fuSYKTo3QxlixGzVCrZsG6D3Rv4KdXgKtkxAAvTi/7jVEu0WovjbpFlz2VoQT86zhQUmU6S8QWkMlk8kMvEzr+QUrS08ks+8BaSi7Kw+4NmfDNNd/EmI9j8NTWQEWajebOcJYl2n7HaXNw== hadoop@hadoop2.com
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5O2ru0IFgXmEdRvr/7cV9cJjZ2/MrYI7ip3UttVu1y6NskQBtqWPE08pxeX3VHoxtqFoqoJCdSlpr9KByngD4Z9U6d5j2UtLbZ9ZCs59YjSO+pinZaXpeKlXH4revdfoRJtmpG4FfyBDi11maDzoJEKObyz3Pi4QxvmI12NQtttFcCRPfv7MqT9l0tuwY5aRbCZVeybWwyZjhtI15p2NAB/042OsQ/FXLvtqVRl4+IOol0yjgi8KTKaBlvWDeKVrLzl4h0tuFUcfNv0yUW+KzrTD7Zj8Q7SpFg73uLn0Ufeq5UtCo0+poMpl+yVcZt0SD1Yic8Er5/i61Pg1ehCFKQ== hadoop@hadoop1.com
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA8wZr0bFUb0KeD8RfnX0KmujcpRw2r5hb/Opfp1ZXGU36BMmZDRwWHB8E1WaezRUubGVa/HTFm6zV7jetEJAsx9jUIPjEfRd25vW/Xej6gaYlUSg7yTf3H3KTb3wNmqiDziSD8yg9G0bPGcNXVfYAz7CEBPAxk9QFSJNtXxFeqSb9yKdBOzsA4hx1oLwV7G/xOUlCzuwSaS5YMG5eKrn1TDCK+FxcBxk6QpNAWO665XeKN/JTZi1bIQEAqC1tJJo1VFgW9/+gE2skI9RpJapVDm+TiZU/wOVqQek/hFLEfhL5f56wsJlz9lOBhxBPBGAbOBlzCJJCiOhmyx7sW73+Tw== hadoop@hadoop3.com
</div>
</div>
</div>
scp :復制給其他的主機
scp authorized_keys hadoop@192.168.253.188:.ssh/
</div>
3.接下來配置所有的hosts文件[root@hadoop1 .ssh]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.253.188 hadoop1.com
192.168.253.189 hadoop2.com
192.168.253.190 hadoop3.com
~
</div>
wq保存。
分發:
[root@hadoop1 .ssh]# scp /etc/hosts root@hadoop2.com:/etc/hosts
</div>
[root@hadoop1 .ssh]# scp /etc/hosts root@hadoop3.com:/etc/hosts
</div>
4.配置完成檢查是否可以免秘鑰登錄[hadoop@hadoop2 ~]$ ssh hadoop3.com
The authenticity of host 'hadoop3.com (192.168.253.190)' can't be established.
RSA key fingerprint is 16:c3:fc:d7:fc:db:98:ba:ef:aa:54:e4:d9:f5:51:be.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'hadoop3.com' (RSA) to the list of known hosts.
[hadoop@hadoop3 ~]$
</div>
服務器之間可以互相ssh登錄,成功
5.安裝ambari[root@hadoop1 ~]# yum install wget
</div>
安裝wget工具
首先需要獲取 Ambari 的公共庫文件(public repository)。登錄到 Linux 主機并執行下面的命令(也可以自己手工下載):
wget http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.0.1/ambari.repo
將下載的 ambari.repo 文件拷貝到 Linux 的系統目錄/etc/yum.repos.d/。拷貝完后,我們需要獲取該公共庫的所有的源文件列表。依次執行以下命令。
yum clean all
yum list|grep ambari
Cleaning up list of fastest mirrors
[root@hadoop1 yum.repos.d]# yum list|grep ambari
ambari-agent.x86_64 2.0.1-45 Updates-ambari-2.0.1
ambari-log4j.noarch 2.0.1.45-1 Updates-ambari-2.0.1
ambari-metrics-collector.x86_64 2.0.1-45 Updates-ambari-2.0.1
ambari-metrics-common.noarch 2.0.1-45 Updates-ambari-2.0.1
ambari-metrics-hadoop-sink.x86_64 2.0.1-45 Updates-ambari-2.0.1
ambari-metrics-monitor.x86_64 2.0.1-45 Updates-ambari-2.0.1
ambari-server.noarch 2.0.1-45 Updates-ambari-2.0.1
hdp_mon_ganglia_addons.noarch 2.0.1.45-1.el6 Updates-ambari-2.0.1
hdp_mon_nagios_addons.noarch 2.0.1.45-1.el6 Updates-ambari-2.0.1
</div>
6.ambari配置待安裝完成后,便需要對 Ambari Server 做一個簡單的配置。執行下面的命令。 amari-server setup [root@hadoop1 ~]# ambari-server setup
Using python /usr/bin/python2.6
Setup ambari-server
Checking SELinux...
SELinux status is 'enabled'
SELinux mode is 'enforcing'
Temporarily disabling SELinux
WARNING: SELinux is set to 'permissive' mode and temporarily disabled.
OK to continue [y/n] (y)? y
Customize user account for ambari-server daemon [y/n] (n)?
Adjusting ambari-server permissions and ownership...
Checking iptables...
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)?
Checking JDK...
[1] Oracle JDK 1.7
[2] Oracle JDK 1.6
[3] - Custom JDK
==============================================================================
Enter choice (1): 1
To download the Oracle JDK and the Java Cryptography Extension (JCE) Policy Files you must accept the license terms found at http://www.oracle.com/technetwork/java/javase/terms/license/index.html and not accepting will cancel the Ambari Server setup and you must install the JDK and JCE files manually.
Do you accept the Oracle Binary Code License Agreement [y/n] (y)?
Downloading JDK from http://public-repo-1.hortonworks.com/ARTIFACTS/jdk-7u67-linux-x64.tar.gz to /var/lib/ambari-server/resources/jdk-7u67-linux-x64.tar.gz
7.ambari啟動簡單的 setup 配置完成后。就可以啟動 Ambari 了。運行下面的命令。 ambari-server start [root@hadoop1 ~]# ambari-server start
Using python /usr/bin/python2.6
Starting ambari-server
Ambari Server running with administrator 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.
通過命令tail -f /var/log/ambari-server/ambari-server.log 查看服務器日志
[root@hadoop1 ~]# tail -f /var/log/ambari-server/ambari-server.log
29 Dec 2015 13:25:44,472 INFO [main] Configuration:514 - Generation of file with password
29 Dec 2015 13:25:46,115 INFO [main] Configuration:527 - Reading password from existing file
29 Dec 2015 13:25:47,753 INFO [main] Configuration:527 - Reading password from existing file
29 Dec 2015 13:25:48,195 INFO [main] ViewExtractor:82 - Creating archive folder /var/lib/ambari-server/resources/views/work/ADMIN_VIEW{2.0.0}.
29 Dec 2015 13:25:48,196 INFO [main] ViewExtractor:89 - Extracting files from ambari-admin-2.0.1.45.jar.
29 Dec 2015 13:25:49,386 INFO [main] Configuration:527 - Reading password from existing file
29 Dec 2015 16:32:07,171 INFO [main] Configuration:527 - Reading password from existing file
29 Dec 2015 16:32:07,213 INFO [main] Configuration:747 - Hosts Mapping File null
29 Dec 2015 16:32:07,213 INFO [main] HostsMap:60 - Using hostsmap file null
29 Dec 2015 16:32:08,470 INFO [main] ControllerModule:173 - Detected POSTGRES as the database type from the JDBC URL
29 Dec 2015 16:32:18,870 INFO [main] AmbariServer:655 - Getting the controller
29 Dec 2015 16:32:22,555 INFO [main] StackDirectory:408 - Stack '/var/lib/ambari-server/resources/stacks/HDP/2.0.6.GlusterFS' doesn't contain an upgrade directory
29 Dec 2015 16:32:22,613 INFO [main] StackDirectory:429 - Role command order info was loaded from file: /var/lib/ambari-server/resources/stacks/HDP/2.0.6.GlusterFS/role_command_order.json
29 Dec 2015 16:32:22,703 INFO [main] StackDirectory:408 - Stack '/var/lib/ambari-server/resources/stacks/HDP/2.1.GlusterFS' doesn't contain an upgrade directory
8.完成打開地址
![]() Charles 2015-12-29于Phnom Phen
版權說明:
本文由Charles Dong原創,本人支持開源以及免費有益的傳播,反對商業化謀利。
CSDN博客:http://blog.csdn.net/mrcharles
個人站:http://blog.xingbod.cn
EMAIL:charles@xingbod.cn
來自: http://blog.csdn.net//mrcharles/article/details/50429547 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!
相關經驗相關資訊 |