注意:
本次搭建只是尝试,检查是否有其他兼容性问题。
本篇文章主要描述:下载到部署成功,能够打开页面即可。服务相关的操作问题将后续完成发布。
系统环境 | Kylin Linux Advanced Server release V10 (Tercel) |
---|---|
CPU | Hygon C86 5285 16-core Processor (海光)架构:x86_64 |
Ambari版本 | 2.7.5 |
HDP版本 | 3.1.5.0 |
关于安装包的下载和前期服务器准备工作,可以参考另一位博主的文章:http://t.csdn.cn/Yj6Ub 第一章第一节安装包准备。
本人之前的文章也有相关说明:
麒麟操作系统-01-java环境说明和安装:http://t.csdn.cn/tN1ju
麒麟操作系统-02-hosts域名映射、ssh免密等:http://t.csdn.cn/1eSZh
MySQL数据库的安装(tar.gz包):http://t.csdn.cn/7mpJL (rpm包可以自行百度)
安装ambari-server和ambari-agent之前,我们需要制作本地的yum源,这样可以使用
yum install PackageName
进行自动安装,十分方便。
每台服务器都要安装httpd
yum -y install httpd
#开启httpd服务
systemctl start httpd
#设置开机自启
systemctl enable httpd
注意:若是遇到yum无法下载的情况,请自行百度更换yum源,网络上有很多教程。如有需要,可以留言,我会总结一篇。一般情况下centos不会有这种问题,我只在麒麟V10上遇到过。修改测试完成后再执行上述命令。
创建文件夹并上传安装包
mkdir -p /opt/software/ambari
#使用工具上传
解压 mysql-connector-java-5.1.40.tar.gz
tar -zxvf mysql-connector-java-5.1.40.tar.gz
#将解压后目录中的 mysql-connector-java-5.1.40-bin.jar 复制到/usr/share/java/下
mv mysql-connector-java-5.1.40-bin.jar /usr/share/java/mysql-connector-java.jar
mkdir /var/www/html/libtrpc
mv libtirpc-0.2.4-0.16.el7.x86_64.rpm /var/www/html/libtrpc
mv libtirpc-devel-0.2.4-0.16.el7.x86_64.rpm /var/www/html/libtrpc
cd /var/www/html/libtrpc
createrepo .
tar -zxvf ambari-2.7.5.0-centos7.tar.gz -C /var/www/html/
tar -zxvf HDP-3.1.5.0-centos7-rpm.tar.gz -C /var/www/html/
tar -zxvf HDP-GPL-3.1.5.0-centos7-gpl.tar.gz -C /var/www/html/
tar -zxvf HDP-UTILS-1.1.0.22-centos7.tar.gz -C /var/www/html/
可以看到HDP、HDP-GPL、HDP-UTILS的权限有些不同,修改目录权限并编辑3个本地源
[root@node1 html]# chown -R root:root HDP
[root@node1 html]# chown -R root:root HDP-GPL
[root@node1 html]# chown -R root:root HDP-UTILS
[root@node1 html]# chmod -R 755 HDP
[root@node1 html]# chmod -R 755 HDP-GPL
[root@node1 html]# chmod -R 755 HDP-UTILS
#编辑三个本地源:
[root@node1 html]# vim /etc/yum.repos.d/ambari.repo
[Ambari-2.7.5.0]
name=Ambari-2.7.5.0
baseurl=http://node1/ambari/centos7/2.7.5.0-72/
gpgcheck=0
enabled=1
priority=1
[root@node1 html]# vim /etc/yum.repos.d/HDP.repo
[HDP-3.1.5.0]
name=HDP Version - HDP-3.1.5.0
baseurl=http://node1/HDP/centos7/3.1.5.0-152/
gpgcheck=0
enabled=1
priority=1
[HDP-UTILS-1.1.0.22]
name=HDP-UTILS Version - HDP-UTILS-1.1.0.22
baseurl=http://node1/HDP-UTILS/centos7/1.1.0.22/
gpgcheck=0
enabled=1
priority=1
[HDP-GPL-3.1.5.0]
name=HDP-GPL Version - HDP-GPL-3.1.5.0
baseurl=http://node1/HDP-GPL/centos7/3.1.5.0-152
gpgcheck=0
enabled=1
priority=1
[root@node1 html]# vim /etc/yum.repos.d/libtrpc.repo
[libtirpc_repo]
name=libtirpc-0.2.4-0.16
baseurl=http://node1/libtrpc/
gpgcheck=0
enabled=1
priority=1
分发到其他节点:
scp /etc/yum.repos.d/ambari.repo node2:/etc/yum.repos.d/
scp /etc/yum.repos.d/HDP.repo node2:/etc/yum.repos.d/
scp /etc/yum.repos.d/libtrpc.repo node2:/etc/yum.repos.d/
#node2可以改为node3/4/5...
#分别在每台机器上执行:
cd /etc/yum.repos.d/
yum clean all
yum makecache
至此,我们就可以使用yum来安装我们上传的安装包了。
安装ambari-server
yum -y install ambari-server
复制mysql jdbc驱动到/var/lib/ambari-server/resources/
cp /usr/share/java/mysql-connector-java.jar /var/lib/ambari-server/resources/
配置/etc/ambari-server/conf/ambari.properties,添加如下行
vim /etc/ambari-server/conf/ambari.properties
server.jdbc.driver.path=/usr/share/java/mysql-connector-java.jar
关键来了!!!
yum 安装完server后,需要修改ambari-server的系统检查设置
vim /usr/lib/ambari-server/lib/ambari_commons/os_check.py
# :set nu 可以显示脚本行数
一共需要修改三处:
第一处:在80行左右相似格式的地方插入如下代码(注意格式对齐)
_IS_KYLIN_LINUX = os.path.exists('/etc/kylin-release')
第二处:在90行左右相似格式的地方插入如下代码
def _is_kylin_linux():
return _IS_KYLIN_LINUX
第三处:在210行左右相似格式的地方插入如下代码
elif _is_kylin_linux():
distribution =("centos","7","core")
初始化ambari数据库连接配置:
ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
安装ambari-server:
ambari-server setup
# 提示是否自定义设置。输入:y
Customize user account for ambari-server daemon [y/n] (n)? y
# ambari-server 账号。
Enter user account for ambari-server daemon (root):
# 如果直接回车就是默认选择root用户
Adjusting ambari-server permissions and ownership...
# 检查防火墙是否关闭
Adjusting ambari-server permissions and ownership...
Checking firewall...
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)?
# 直接回车
# 设置JDK。输入:2
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
# 如果上面选择3自定义JDK,则需要设置JAVA_HOME。输入:/opt/module/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 use Kerberos,please make sure JCE Unlimited Strength Jurisdiction Policy Files are valid on all hosts.
Path to JAVA_HOME: /opt/module/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...
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...
# 数据库配置。选择:y
Configuring database...
Enter advanced database configuration [y/n] (n)? y
# 选择数据库类型。输入:3
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
==============================================================================
Enter choice (3): 3
# 设置数据库的具体配置信息,根据实际情况输入,如果和括号内相同,则可以直接回车。如果想重命名,就输入。
Hostname (localhost):
Port (3306):
Database name (ambari): ambari
Username (ambari): ambari
Enter Database Password (bigdata):ambari
Re-Enter password: ambari
# 将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
# 这个sql后面会用到,导入数据库
Proceed with configuring remote database connection properties [y/n] (y)? y
登录MySQL
mysql -uroot -p123456
CREATE DATABASE ambari;
use ambari;
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'@'node1' IDENTIFIED BY 'ambari';
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'node1';
-- 加载刚才生成的sql脚本
source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
每台服务器都要执行
yum -y install ambari-agent
在主节点(安装server的节点)启动ambari-server
ambari-server start
启动成功会提示webUI地址:http://hostname:8080
账户:admin 密码:admin
未完待续。