技术交流QQ群:①185473046   ②190706903   ③203744115   网站地图
登录

下次自动登录
现在的位置: 首页Linux>正文
大数据集群环境ambari支持集群管理监控,供应hadoop+hbase+zookeeper
2016年11月01日 Linux 暂无评论 ⁄ 被围观 17,097次+

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)
CPU:
核心 : 4核心
cpu MHz : 3192.620
cache size : 6144 KB
clflush size : 64
cache_alignment : 64
address sizes : 42 bits physical, 48 bits virtual
内存
MemTotal: 4G
硬盘
总容量 80G

节点名称
IP1
服务
备注
master
192.168.5.12
ntp,mysql

epele iptables&selinux stop
OpenSSL (v1.01, build 16 or later);

python v2.6;

slave1
192.168.5.13
ntp,

epele iptables&selinux stop
OpenSSL (v1.01, build 16 or later);

python v2.6;

slave2
192.168.5.14
ntp,

epele iptables&selinux stop
OpenSSL (v1.01, build 16 or later);

python v2.6;

2.ssh免秘钥登录

创建用户hadoop

[root@master ~]# useradd hadoop
[root@master ~]# passwd hadoop
修改密码
所有机器都使用同样的密码最好。
*在配置密钥的过程中,可以选择root用户生成密钥也可以选择su hadoop账户生成密钥,必须在配置好主机名的前提下生成密钥,密钥拷贝的过程尽量是采用同步的模式避免出错

使用hadoop用户,命令如下
ssh-keygen -t rsa 生成rsa加密的密钥

cp id_rsa.pub authorized_keys copy文件

cat id_rsa.pub>>authorized_keys 将其他的秘钥追加到这一个文件中,然后分发给所有机器

[hadoop@master .ssh]$ cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAqxuCo78OdD/GIgphhLdKFA+vop4AnyiBaNDYlUE6PPwzqoBZVmmGPjrBV+rM/GQkZ1xrDCabKywvcgz+YW5vmo511bZ9ZBXQXck/zSkHcf84YXZo56dcFd00qpbFA1y/5KhtRn4J1REhHRJFYx99ZlBr9miNnGQfZeEYJsNANzTwJGU9Vc5r5Qvkhi9bJ70THkP0rMm2fuSYKTo3QxlixGzVCrZsG6D3Rv4KdXgKtkxAAvTi/7jVEu0WovjbpFlz2VoQT86zhQUmU6S8QWkMlk8kMvEzr+QUrS08ks+8BaSi7Kw+4NmfDNNd/EmI9j8NTWQEWajebOcJYl2n7HaXNw== hadoop@master.com
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5O2ru0IFgXmEdRvr/7cV9cJjZ2/MrYI7ip3UttVu1y6NskQBtqWPE08pxeX3VHoxtqFoqoJCdSlpr9KByngD4Z9U6d5j2UtLbZ9ZCs59YjSO+pinZaXpeKlXH4revdfoRJtmpG4FfyBDi11maDzoJEKObyz3Pi4QxvmI12NQtttFcCRPfv7MqT9l0tuwY5aRbCZVeybWwyZjhtI15p2NAB/042OsQ/FXLvtqVRl4+IOol0yjgi8KTKaBlvWDeKVrLzl4h0tuFUcfNv0yUW+KzrTD7Zj8Q7SpFg73uLn0Ufeq5UtCo0+poMpl+yVcZt0SD1Yic8Er5/i61Pg1ehCFKQ== hadoop@slave1.com
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA8wZr0bFUb0KeD8RfnX0KmujcpRw2r5hb/Opfp1ZXGU36BMmZDRwWHB8E1WaezRUubGVa/HTFm6zV7jetEJAsx9jUIPjEfRd25vW/Xej6gaYlUSg7yTf3H3KTb3wNmqiDziSD8yg9G0bPGcNXVfYAz7CEBPAxk9QFSJNtXxFeqSb9yKdBOzsA4hx1oLwV7G/xOUlCzuwSaS5YMG5eKrn1TDCK+FxcBxk6QpNAWO665XeKN/JTZi1bIQEAqC1tJJo1VFgW9/+gE2skI9RpJapVDm+TiZU/wOVqQek/hFLEfhL5f56wsJlz9lOBhxBPBGAbOBlzCJJCiOhmyx7sW73+Tw== hadoop@slave2.com
scp :复制给其他的主机

scp authorized_keys hadoop@192.168.5.13:.ssh/

3.接下来配置所有的hosts文件

[root@master .ssh]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.5.12 master
192.168.5.13 slave1
192.168.5.14 slave2
wq保存。

分发:
[root@master .ssh]# scp /etc/hosts root@slave1:/etc/hosts
[root@master .ssh]# scp /etc/hosts root@slave2:/etc/hosts

4.配置完成检查是否可以免秘钥登录

[hadoop@master ~]$ ssh slave1
The authenticity of host 'slave1 (192.168.5.13)' 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 'slave1' (RSA) to the list of known hosts.
[hadoop@slave1 ~]$
服务器之间可以互相ssh登录,成功
5安装mysql yum install mysql mysql-server直接启动mysql创建ambari数据库授权

授权过程中必须保证ambari账户对数据库的读写权限
[root@masterysql -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'@'master';
FLUSH PRIVILEGES;

6安装ambari

[root@master ~]# yum install wget
安装wget工具

首先需要获取 Ambari 的公共库文件(public repository)。登录到 Linux 主机并执行下面的命令(也可以自己手工下载):
wget https://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.0.1/ambari.repo这里下载ambari的yum源必须要选择2.0以上的低版本不兼容mysql和java的高版本
将下载的 ambari.repo 文件拷贝到 Linux 的系统目录/etc/yum.repos.d/。拷贝完后,我们需要获取该公共库的所有的源文件列表。依次执行以下命令。
yum clean all
yum list|grep ambari

Cleaning up list of fastest mirrors
[root@master 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
7.ambari配置

待安装完成后,便需要对 Ambari Server 做一个简单的配置。执行下面的命令。
amari-server setup
[root@master ~]# 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禁用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这个选项可以添加本地的java环境变量选择3可以直接添加本地java的安装路径/usr/java/jdk1.7.0_67
==============================================================================
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 https://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 https://public-repo-1.hortonworks.com/ARTIFACTS/jdk-7u67-linux-x64.tar.gz to /var/lib/ambari-server/resources/jdk-7u67-linux-x64.tar.gz
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):ambari
Username (ambari):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数据库里面ambari数据库里面的表格有没有建立好没有建好手动导入到ambari数据库中
需要登录到mysql数据库,执行以下脚本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
执行脚本,成功。

验证脚本是否初始化成功,出现以下table列表。
mysql> show tables;
+-------------------------------+
| Tables_in_ambari |
+-------------------------------+
| ClusterHostMapping |
| QRTZ_BLOB_TRIGGERS |
| QRTZ_CALENDARS |
| QRTZ_CRON_TRIGGERS |
| QRTZ_FIRED_TRIGGERS |
| QRTZ_JOB_DETAILS |
| QRTZ_LOCKS |
8ambari启动

简单的 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@master ~]# 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
9.完成

打开地址
https://192.168.1.12:8080/ 完成

     

  系统运维技术交流QQ群:①185473046 系统运维技术交流□Ⅰ ②190706903 系统运维技术交流™Ⅱ ③203744115 系统运维技术交流™Ⅲ

给我留言

您必须 [ 登录 ] 才能发表留言!



Copyright© 2011-2024 系统运维 All rights reserved
版权声明:本站所有文章均为作者原创内容,如需转载,请注明出处及原文链接
陕ICP备11001040号-3