总目录:https://www.jianshu.com/p/e406a9bc93a9
Hadoop - 子目录:https://www.jianshu.com/p/9428e443b7fd
HDP版本对照图
注:HDP3以上的版本不再支持Flume。
部署前的准备
配置数据库
- 建立ambari数据库
这里是因为ambari需要一个数据库存放元数据与用户信息。
mysql> create database ambari default character set utf8;
mysql> create user 'ambari'@'%' identified by 'bigdata';
mysql> grant all privileges on ambari. * to 'ambari'@'%';
mysql> flush privileges;
- 导入JDBCjar包
上传mysql-connector-java-5.1.XX.jar
。
chmod 777 mysql-connector-java-5.1.XX.jar
ln -s mysql-connector-java-5.1.XX.jar mysql-connector-java.jar
配置ambari-yum源
先创建一个目录存放需要用到的文件。
[root@ambari hdk] cd /var/www/html/
[root@ambari html] mkdir hdp_repo
第一个文件:ambari-2.7软件包
https://docs.cloudera.com/HDPDocuments/Ambari-2.7.1.0/bk_ambari-installation/content/ambari_repositories.html
第二,三,四个文件:HDP,HDP-UTILS,HDP-GPL
https://docs.cloudera.com/HDPDocuments/Ambari-2.7.1.0/bk_ambari-installation/content/hdp_30_repositories.html
然后把四个工具包全部上传上来,解压。
然后删掉工具包,访问:http://192.168.10.190/hdp_repo。
然后去yum源存放的目录,为他们添加本地源。
cd /etc/yum.repo.d/
vi ambari.repo
cat ambari.repo
[ambari-2.7.1.0]
name=ambari_repo
baseurl=http://192.168.10.190/hdp_repo/ambari/centos7/2.7.1.0-169
gpgcheck=0
enabled=1
vi hdp.repo
cat hdp.repo
[HDP-3.0.1.0]
name=hdp_repo
baseurl= http://192.168.10.190/hdp_repo/HDP/centos7/3.0.1.0-187
gpgcheck=0
enabled=1
vi hdp-utils.repo
cat hdp-utils.repo
[HDP-UTILS-1.1.0.22]
name=hdp_utils_repo
baseurl= http://192.168.10.190/hdp_repo/HDP-UTILS/centos7/1.1.0.22
gpgcheck=0
enabled=1
vi hdp-gpl.repo
cat hdp-gpl.repo
[HDP-GPL-3.0.1.0-187]
name=hdp_gpl_repo
baseurl= http://192.168.10.190/hdp_repo/HDP-GPL/centos7/3.0.1.0-187
gpgcheck=0
enabled=1
部署ambari
安装
yum install ambari-server
连接数据库
首先把mysql的jar包传上来。
cd /usr/share
mkdir java
#上传
chmod 777 mysql-connector-java-5.1.46.jar
mv mysql-connector-java-5.1.46.jar mysql-connector-java.jar
然后把jar包导入进去。
ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
初始化Ambari Server
[root@ambari ~]# ambari-server setup
Using python /usr/bin/python
Setup ambari-server
Checking SELinux...
SELinux status is 'disabled'
// 这里就是将selinux设置为disabled的原因,否则这里会有一个警告
Customize user account for ambari-server daemon [y/n] (n)? n
// 提示是否自定义设置。输入:n 一些基础配置让他自己配置
Adjusting ambari-server permissions and ownership...
Checking firewall status...
Checking JDK...
Do you want to change Oracle JDK [y/n] (n)? y
[1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8
[2] Custom JDK
==============================================================================
Enter choice (1): 2
// 自定义jdk
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 u
se Kerberos,please make sure JCE Unlimited Strength Jurisdiction Policy Files are valid on all hosts.Path to JAVA_HOME: /usr/hdk/jdk8
// 输入jdk安装路径
Validating JDK on Ambari Server...done.
Check JDK version for Ambari Server...
JDK version found: 8
Minimum JDK version is 8 for Ambari. Skipping to setup different JDK for Ambari Server.
Checking GPL software agreement...
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 (3): 3
// 选择MySQL
Hostname (192.168.10.190): ambari.com
// 主机名
Port (3306):
Database name (ambari):
Username (ambari):
Enter Database Password (bigdata):
Configuring ambari database...
Enter full path to custom jdbc driver: /usr/hdk/jar/mysql-connector-java.jar
// 设置JDBCjar包存放的位置
Copying /usr/hdk/jar/mysql-connector-java.jar to /usr/share/java
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.sqlProceed with configuring remote database connection properties [y/n] (y)?
// 将Ambari数据库脚本手动导入到数据库
Extracting system views...
ambari-admin-2.7.1.0.169.jar
....
Ambari repo file doesn't contain latest json url, skipping repoinfos modification
Adjusting ambari-server permissions and ownership...
Ambari Server 'setup' completed successfully.
初始化Ambari数据库
mysql -u root -p
mysql> use ambari;
mysql> source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql;
启动Ambari
[root@ambari jar]# ambari-server start
Using python /usr/bin/python
Starting ambari-server
Ambari Server running with administrator privileges.
Organizing resource files at /var/lib/ambari-server/resources...
Ambari database consistency check started...
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....................................
Server started listening on 8080
DB configs consistency check: no errors and warnings were found.
Ambari Server 'start' completed successfully.
然后访问:http://192.168.10.190:8080