ambari安装部署
Apache Ambari是一种基于Web的工具,支持Apache Hadoop集群的供应、管理和监控。Ambari已支持大多数Hadoop组件,包括HDFS、MapReduce、Hive、Pig、 Hbase、Zookeeper、Sqoop和Hcatalog等。
Apache Ambari 支持HDFS、MapReduce、Hive、Pig、Hbase、Zookeepr、Sqoop和Hcatalog等的集中管理。也是5个顶级hadoop管理工具之一。
安装环境说明
一台主节点(master),一台次节点(slaver)。master节点内存6个G,slaver节点内存4个G。
Ambari2.6.1.5源
HDP 2.5.0.0源
HDP-UTILS 1.1.0.22源
jdk
VMware15.0
基础环境搭建
1.修改主机名(两节点都要进行)
[root@localhost ~]# hostnamectl set-hostname master
[root@localhost ~]# bash
[root@master ~]#
2.关闭防火墙和selinux规则
[root@master ~]# vi /etc/sysconfig/selinux
将enforcing改为disabled
[root@master ~]# setenforce 0
[root@master ~]# getenforce
Permissive
[root@master ~]# systemctl stop firewalld
[root@master ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
[root@master ~]#
3.配置主机映射
[root@master ~]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.200.120 master.hadoop master
192.168.200.121 slaver.hadoop
[root@slaver ~]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.200.120 master.hadoop
192.168.200.121 slaver.hadoop slaver
离线源的配置
将之前准备的包传输到master节点上
[root@master ~]# ls
ambari-2.6.1.5-centos7.tar.tar anaconda-ks.cfg HDP-2.5.0.0-centos7-rpm.tar.gz HDP-UTILS-1.1.0.22-centos7.tar.tar jdk-8u77-linux-x64.tar.gz
创建两个目录
[root@master ~]# mkdir /opt/ambari/
[root@master ~]# mkdir /opt/centos/
将ambari-2.6.1.5-centos7.tar.tar解压到/opt/ambari/
[root@master ~]# tar -zxvf ambari-2.6.1.5-centos7.tar.tar -C /opt/ambari/
挂载镜像
[root@master ~]# mount -o loop /dev/cdrom /opt/centos/
编写local.repo,删除/etc/yum.repos.d/目录下的所有文件或者将其移动到其他位置
[root@master yum.repos.d]# vi local.repo
[ambari]
name=ambari
baseurl=file:///opt/ambari/ambari/centos7/2.6.1.5-3
gpgcheck=0
enable=1
[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enable=1
保存退出
下载vsftpd并且安装配置ftp服务
[root@master ~]# yum -y install vsftpd
[root@master ~]# vi /etc/vsftpd/vsftpd.conf
添加:
anon_root=/opt
退出重启vsftpd
[root@master ~]# systemctl restart vsftpd
在slaver节点配置源
在/etc/yum.repos.d/路径下
[root@slaver ~]# vi local.repo
[ambari]
name=ambari
baseurl=ftp://192.168.200.120/ambari/ambari/centos7/2.6.1.5-3
gpgcheck=0
enable=1
[centos]
name=centos
baseurl=ftp://192.168.200.120/centos
gpgcheck=0
enable=1
配置SSH
# master & slaver
检查2个节点是否可以通过无密钥相互访问,如果未配置,则进行SSH无密码公钥认证配置。如下:
# yum install openssh-clients
# ssh-keygen
# ssh-copy-id master.hadoop
# ssh-copy-id slave1.hadoop
ssh登录远程主机查看是否成功
# ssh master.hadoop
# exit
# ssh slave1.hadoop
# exit
配置ntp
# master
# yum -y install ntp
# vi /etc/ntp.conf
注释或者删除以下四行
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
添加以下两行
server 127.127.1.0
fudge 127.127.1.0 stratum 10
#systemctl enable ntpd
#systemctl start ntpd
# slaver
# yum -y install ntpdate
# ntpdate master.hadoop
# systemctl enable ntpdate
配置http服务
# master
# yum -y install httpd
将HDP-2.6.1.0和HDP-UTILS-1.1.0.21两个文件夹拷贝到/var/www/html/目录下。启动httpd服务。
[root@master ~]# tar -zxvf HDP-2.5.0.0-centos7-rpm.tar.gz -C /var/www/html/
[root@master ~]# tar -zxvf HDP-UTILS-1.1.0.22-centos7.tar.tar -C /var/www/html/
# systemctl enable httpd.service
# systemctl status httpd.service
通过网页访问验证
安装配置jdk
master节点操作
[root@master ~]# mkdir /usr/jdk64/
[root@master ~]# tar -zxvf jdk-8u77-linux-x64.tar.gz -c /usr/jdk64/
[root@master ~]# vi /etc/profile
添加:
export JAVA_HOME=/usr/jdk64/jdk1.8.0_77
export PATH=$JAVA_HOME/bin:$PATH
[root@master ~]# source /etc/profile
[root@master ~]# java -version
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
slaver节点操作
[root@slaver ~]# mkdir /usr/jdk64
[root@slaver ~]# scp root@192.168.200.120:/root/jdk-8u77-linux-x64.tar.gz /root/
[root@slaver ~]# tar -zxvf jdk-8u77-linux-x64.tar.gz -C /usr/jdk64/
[root@slaver ~]# vi /etc/profile
添加:
export JAVA_HOME=/usr/jdk64/jdk1.8.0_77
export PATH=$JAVA_HOME/bin:$PATH
[root@slaver ~]# source /etc/profile
[root@slaver ~]# java -version
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
安装ambari-server
master节点
[root@master ~]# yum -y install ambari-server
安装配置mariadb数据库
master节点
[root@master ~]# yum install mariadb mariadb-server mysql-connector-java
启动数据库,并且设置开机自启
[root@master ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@master ~]# systemctl start mariadb
[root@master ~]#
配置数据库
[root@master ~]# mysql_secure_installation
这里笔者设置的密码为000000
进入数据库创建用户并导入数据库
[root@master ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 5.5.44-MariaDB MariaDB Server
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database ambari;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on ambari.* to 'ambari'@'localhost' identified by '000000';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all privileges on ambari.* to 'ambari'@'%' identified by '000000';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> use ambari;
Database changed
MariaDB [ambari]> source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
配置ambari-server
[root@master ~]# vi /etc/profile
添加:
export buildNumber=2.6.1.5(这个是所用ambari的版本号)
[root@master ~]# 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/jdk64/jdk1.8.0_77(jdk的绝对路径)
Validating JDK on Ambari Server...done.
Checking GPL software agreement...
GPL License for LZO: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
Enable Ambari Server to download and install GPL Licensed LZO packages [y/n] (n)? y
Completing setup...
Configuring database...
Enter advanced database configuration [y/n] (n)? y
Configuring database...
==============================================================================
Choose one of the following options:
[1] - PostgreSQL (Embedded)
[2] - Oracle
[3] - MySQL / MariaDB
[4] - PostgreSQL
[5] - Microsoft SQL Server (Tech Preview)
[6] - SQL Anywhere
[7] - BDB
==============================================================================
Enter choice (1): 3
Hostname (localhost):
Port (3306):
Database name (ambari):
Username (ambari):
Enter Database Password (bigdata): (输入刚刚创建数据库的密码)
Re-enter password:
Configuring ambari database...
Configuring remote database connection properties...
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)?
Extracting system views...
ambari-admin-2.6.1.5.3.jar
...........
Adjusting ambari-server permissions and ownership...
Ambari Server 'setup' completed successfully.
[root@master ~]# ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
Using python /usr/bin/python
Setup ambari-server
Copying /usr/share/java/mysql-connector-java.jar to /var/lib/ambari-server/resources
If you are updating existing jdbc driver jar for mysql with mysql-connector-java.jar. Please remove the old driver jar, from all hosts. Restarting services that need the driver, will automatically copy the new jar to the hosts.
JDBC driver was successfully initialized.
Ambari Server 'setup' completed successfully.
[root@master ~]#
启动ambari-server,并且访问
[root@master ~]# ambari-server start
登陆用户名和密码都为admin.
安装ambari-agent
master和slaver两台节点都要安装,两台机子的操作相同
[root@master ~]# yum -y install ambari-agent
[root@master ~]# vi /etc/ambari-agent/conf/ambari-agent.ini
找到
hostname=localhost(将localhost改为master.hadoop)
重启ambari-agnet
[root@master ~]# ambari-agent restart
安装步骤
创建集群的名称
选择对应的HDP的版本,选择使用本地存储库。
填写主机名,主机注册信息选择第二个
选择如下图的四个服务
这里需要填写的用户名和密码都填写admin,如果有什么警告的话不用管,八成是资源问题。这个很正常,毕竟大家的电脑的配置也没有很高。
这个过程有点长,需要耐心等待一下
最后的展示界面