栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

HDP3.1.5+Ambari2.7.5安装

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

HDP3.1.5+Ambari2.7.5安装

第一步:搭建环境准备

HDP安装包,通过网盘获取,这里注意网盘中没有Mysql包,自己准备就行,或者去我的CDH共享中获取
链接:https://pan.baidu.com/s/1XmSqP08IvbA2BTUniMw8ZQ
提取码:jaco

系统使用CentOS 7 64位
服务器节点三台、修改静态IP、主机名:
192.168.88.166 node1
192.168.88.167 node2
192.168.88.168 node3

配置:单台8核10G

第二步:关闭防火墙与selinux

关闭防火墙与selinux
vi /etc/sysconfig/selinux
SELINUX=disabled

systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl status firewalld.service

第三步:ssh互信与同步时间

节点ssh互信,见博客批量方式SSH互信
同步时间,见博客Linux同步时间方式


第四步:所有节点关闭透明大页与swap

a) 执行sysctl vm.swappiness=10,改变运行时的参数
打开/etc/sysctl.conf文件,添加vm.swappiness=10条目,然后sysctl -p生效修改

b) 执行下面两句话,改变运行时参数
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled
并将这两句话添加到/etc/rc.local文件中,以便重启后生效

第五步:安装JAVA-JDK

a) 将大家自己准备好的JDK的包,上传到各节点并解压缩到/usr/java/目录下,注意必须是/usr/java这个目录

b) 配置java环境变量,在/etc/profile中添加如下内容,注意使用自己的版本

export JAVA_HOME=/usr/java/jdk1.8.0_162
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

c) source /etc/profile

d) 将jdk推送给其它节点

scp -r jdk1.8.0_162/ n1:/usr/java/jdk1.8.0_162
scp -r jdk1.8.0_162/ n2:/usr/java/jdk1.8.0_162
scp -r jdk1.8.0_162/ n3:/usr/java/jdk1.8.0_162

e) 在各节点执行source /etc/profile,并通过java -version测试java


第六步:在node1上搭建本地yum源

如果看过我CHD安装手册的网友,不要直接就去搭建Python的服务,HDP我们使用httpd服务,因为Python的http服务性能不够,HDP的包太多了

首先安装httpd服务,并启动它

yum -y install httpd
systemctl start httpd
systemctl enable httpd.service

systemctl stop httpd

安装后访问http://IP出现服务测试页就好

随后进入 /etc/yum.repos.d/ 目录下,把里面系统自带的repo文件存放到一个备用目录下,并和CHD一样上传系统镜像包,并挂载到某一目录下,这里任然挂载到/mnt,然后使用cp命令把镜像包里的内容移动到http服务目录去,这样就不用其他节点也挂载本地镜像了,并且将Mysql也上传到特定目录下。

mount 系统iso文件 /mnt
mkdir /var/www/html/iso
cp -r /mnt/* /var/www/html/iso

mysql上传到/var/www/html/mysql下

创建/etc/yum.repos.d/base.repo文件,增加如下内容源到repo文件中

[ISO]
name=ISO
baseurl=http://node1/iso
gpgcheck=0
enabled=1

[Mysql-5.7.16]
name=Mysql-5.7.16
baseurl=http://node1/mysql
gpgcheck=0
enabled=1

将HDP用到的tar包解压到/var/www/html/路径下

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/

创建/etc/yum.repos.d/ambari.repo文件,增加如下内容源到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

创建/etc/yum.repos.d/HDP.repo,增加如下内容源到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

最后更新yum源

yum clean all
yum repolist

到此,如果你运行yum repolist命令报错找不到文件,一般是找不到HDP、ambari的xml或安装包,这时你用浏览器访问http路径,如果无响应那就考虑换CDH集群吧,因为HDP的安装包太大了,如果没有厂家服务,基本没有解决的办法,这也是中国市场上很少有用HDP的,一般都是CDH


第七步:安装Mysql

a) 检查并卸载cm节点原有的mysql相关文件

rpm -qa | grep -i mysql
rpm -ev --nodeps 上面命令的执行结果列表
find / -name mysql,手工删除查找结果。查找结果举例:/var/lib/mysql、/usr/lib/mysql、/usr/lib64/mysql、/usr/include/mysql、/etc/my.cnf

b)使用yum从本地源中安装Mysql

yum -y install mysql-community-server mysql-community-client


c) 根据实际需要考虑是否修改/etc/my.cnf配置文件,一般不用特意更改

d) 设置MySQL开机启动并启动MySQL

systemctl enable mysqld.service
systemctl start mysqld.service
systemctl status mysqld.service

e) 执行grep password /var/log/mysqld.log获得初始密码,例如下图中末尾的那一串密码

f) 执行mysql_secure_installation命令,对MySQL做基础配置

Securing the MySQL server deployment.

Enter password for user root: 输入初始密码

The existing password for the user account root has expired. Please set a new password.

New password: 输入新密码,例如Root123!

Re-enter new password: Root123!
The 'validate_password' plugin is installed on the server.
The subsequent steps will run with the existing configuration
of the plugin.
Using existing password for root.

Estimated strength of the password: 100 
Change the password for root ? ((Press y|Y for Yes, any other key for No) : n
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!

g) 进入mysql,使用命令show variables like “%char%”; 检查字符集是否为utf8,如果不是改过来

h) JDBC链接
所有节点,创建/usr/share/java目录,将mysql-connector-java-5.1.47.jar文件上传至该目录,并重命名为mysql-connector-java.jar

i)创建用户,这里先准备两个,其他的大家用到了套用语句创建就可。

CREATE DATABASE ambari DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;  
GRANT ALL ON ambari.* TO 'ambari'@'%' IDENTIFIED BY 'Wangyang#123';

CREATE DATABASE hive DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; 
GRANT ALL ON hive.* TO 'hive'@'%' IDENTIFIED BY 'Wangyang#123'; 

flush privileges;

第八步:安装Ambari

安装服务

yum -y install ambari-server

拷贝mysql驱动到特定目录下

cp /usr/share/java/mysql-connector-java.jar /var/lib/ambari-server/resources/

修改配置文件,末尾追加数据库驱动配置

vi /etc/ambari-server/conf/ambari.properties
server.jdbc.driver.path=/usr/share/java/mysql-connector-java.jar

运行命令设置驱动

ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar

进入mysql中的ambari库,运行ambari的sql文件

source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql;

运行命令,开始初始化ambari服务

ambari-server setup
(1) 提示是否自定义设置。输入:y
Customize user account for ambari-server daemon [y/n] (n)? y
(2)ambari-server 账号。
Enter user account for ambari-server daemon (root):
如果直接回车就是默认选择root用户
如果输入已经创建的用户就会显示:
Enter user account for ambari-server daemon (root):ambari
Adjusting ambari-server permissions and ownership...
(3)检查防火墙是否关闭
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)?
直接回车
(4)设置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
选择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 use Kerberos,please make sure JCE Unlimited Strength Jurisdiction Policy Files are valid on all hosts.
Path to JAVA_HOME: /usr/local/java
Validating JDK on Ambari Server...done.
Completing setup...
(5)数据库配置。选择:y
Configuring database...
Enter advanced database configuration [y/n] (n)? y
(6)选择数据库类型。输入: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
(7)设置数据库的具体配置信息,根据实际情况输入,如果和括号内相同,则可以直接回车。如果想重命名,就输入。
Hostname (localhost):hdp1
Port (3306): 3306
Database name (ambari): ambari
Username (ambari): ambari
Enter Database Password (bigdata):Wangyang_123
这里有个坑,HDP所使用的的数据库密码只能是数字、字符、下划线组成,其他的字符会报错
Re-Enter password: Wangyang_123
(8)将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

启动服务

ambari-server start


第九步:搭建集群

登录http://HDP管理节点IP:8080,账户/密码:admin/admin

之后跟着提示下一步即可

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/929837.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号