全网最详细的ambari集群搭建详细步骤

目录

1、服务器环境说明

2、防火墙设置

3、禁用selinux

4、配置jdk和mysql驱动

5、安装Mysql

6、mysql密码操作

7、安装httpd服务

8、安装ntp

9、ntp配置

10、时钟同步

11、安装yum

12、上传ambari和hdp

13、创建repo文件

14、分发repo文件

15、生成yum源

16、在mysql中创建ambari用户

17、初始化ambari数据库

18、安装ambari

19、ambari配置

20、启动ambari


1、服务器环境说明

  • 集群三台节点
  • 可以互相访问
  • 使用root用户
  • 配置免密
  • centos7
  • ambari-2.6.2.2
  • hdp-2.6.5
  • 在windows的hosts文件中添加环境信息

我的环境如下:

192.168.8.105 my-hdp1
192.168.8.106 my-hdp2
192.168.8.107 my-hdp3

说明:使用root用户

2、防火墙设置

三台节点均执行

#查看防火墙状态
systemctl status firewalld
#关闭防火墙
systemctl stop firewalld
#设置防火墙服务开机不自启
systemctl disable firewalld
#再次查看防火墙检查防火墙是否关闭
systemctl status firewalld

3、禁用selinux

三台节点均执行

vim /etc/selinux.config
把SELINUX=enforcing修改为SELINUX=disabled

4、配置jdk和mysql驱动

三台节点均执行


#创建目录
mkdir /usr/share/java
#该目录在后面需要用的,可以被其他用户访问的,如果是普通用户则不行,建议按这个配置

#上传java
tar -zxf jdk-8u144-linux-x64.tar.gz
#查看java环境
java -version
#将驱动上传到该路径

5、安装Mysql

在my-hdp1上执行

#mysql安装包
rw-rw-r--. 1 sweet sweet 26460548 4月 7 18:30 mysql-community-client5.7.32-1.el7.x86_64.rpm
-rw-rw-r--. 1 sweet sweet 314936 4月 7 18:30 mysql-community-common5.7.32-1.el7.x86_64.rpm
-rw-rw-r--. 1 sweet sweet 2457204 4月 7 18:30 mysql-community-libs5.7.32-1.el7.x86_64.rpm
-rw-rw-r--. 1 sweet sweet 1260336 4月 7 18:30 mysql-community-libscompat-5.7.32-1.el7.x86_64.rpm
-rw-rw-r--. 1 sweet sweet 181712536 4月 7 18:30 mysql-community-server5.7.32-1.el7.x86_64.rpm

#将安装包放在一个目录下,可以一键安装
yum install *

#mysql启动
systemctl start mysqld.service
#mysql开机自启
systemctl status mysqld.service
#mysql状态
systemctl enable mysqld.service

6、mysql密码操作

在my-hdp1上执行

#获取初始化密码
grep "password" /var/log/mysqld.log
#mysql登录
mysql -uroot -pfeEa8F53kn(m
#设置mysql密码安全强度为0
set global validate_password_policy=0;
#设置mysql密码最低长度为1
set global validate_password_length=1;
#修改root用户密码
alter user 'root'@'localhost' identified by 'root';
#授权root用户所有权限并设置本地登录
grant all privileges on *.* to 'root'@'localhost' identified by 'root';
#授权root用户所有权限并设置远程登录
grant all privileges on *.* to 'root'@'%' identified by 'root';
#刷新权限
flush privileges;

7、安装httpd服务

在my-hdp1上执行

#安装
yum install httpd
#开机自启动
systemctl enable httpd.service
#启动httpd服务
systemctl start httpd.service
#查看httpd服务状态
systemctl staus httpd.service

#说明,安装完之后,会生成/var/www/html目录

8、安装ntp

三台节点均执行

#安装
yum install ntp
#开机自启动
systemctl enable ntpd
#启动ntp服务
systemctl start ntpd
#查看ntpd服务状态
systemctl status ntpd

9、ntp配置

在my-hdp1上执行

vim /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
#表示ntp主服务器是与自身的系统时钟同步
server 127.127.1.0
#指定阶层编号为10,降低优先度
fudge 127.127.1.0 stratum 10

10、时钟同步

在my-hdp2、my-hdp3上执行

#my-hdp2、my-hdp3执行以下操作
vim /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
#表示ntp主服务器是与自身的系统时钟同步
server 127.127.1.0
#指定阶层编号为10,降低优先度
fudge 127.127.1.0 stratum 10
#配置时间服务器为本地的时间服务器
server my-hdp1
#允许上层时间服务器主动修改本机时间
restrict my-hdp1 nomodify notrap noquery

11、安装yum

三台节点均执行

yum install wget
yum install createrepo
yum install yum-utils
yum repolist

12、上传ambari和hdp

在my-hdp1上执行

#在my-hdp1上执行
#将安装包上传到/var/www/html
ambari-2.6.2.2-centos7.tar.gz
HDP-2.6.5.0-centos7-rpm.tar.gz
HDP-UTILS-1.1.0.22-centos7.tar.gz
#解压
tar -zxf 上面的包

13、创建repo文件

在my-hdp1上执行

#进入/etc/yum.repo.d/
cd /etc/yum.repo.d/
#新建ambari.repo文件
vim ambari.repo
#添加以下内容
[ambari]
name=ambari
baseurl=http://my-hdp1/ambari/centos7/2.6.2.2-1
enabled=1
gpgcheck=0

#新建HDP.repo
vim HDP.repo
#添加以下内容
[HDP]
name=HDP
baseurl=http://my-hdp1/HDP/centos7/2.6.5.0-292
path=/
enabled=1
gpgcheck=0

#新建HDP-UTILS.repo
vim HDP-UTILS.repo
#添加以下内容
[HDP-UTILS]
name=HDP-UTILS
baseurl=http://my-hdp1/HDP-UTILS/centos7/1.1.0.22
path=/
enabled=1
gpgcheck=0

14、分发repo文件

在my-hdp1上执行

#分发文件到my-hdp2、my-hdp3,使用分发的方式避免文件出错
#分发ambari.repo
scp ambari.repo root@my-hdp2:/etc/yum.repo.d
scp ambari.repo root@my-hdp3:/etc/yum.repo.d

#分发HDP.repo
scp HDP.repo root@my-hdp2:/etc/yum.repo.d
scp HDP.repo root@my-hdp3:/etc/yum.repo.d

#分发HDP-UTILS.repo
scp HDP-UTILS.repo root@my-hdp2:/etc/yum.repo.d
scp HDP-UTILS.repo root@my-hdp3:/etc/yum.repo.d

15、生成yum源

在my-hdp1上执行

#在/var/www/html下有三个文件夹
drwxr-xr-x. 3 root root  21 4月   7 14:58 ambari
drwxr-xr-x. 3 1001 users 21 5月  15 2018 HDP
drwxr-xr-x. 3 1001 users 21 8月  13 2018 HDP-UTILS
#分别进入以下目录查看是否有repodata目录
#ambari目录
/var/www/html/ambari/centos7/2.6.2.2-1
#HDP目录
/var/www/html/HDP/centos7/2.6.5.0-292
#HDP-UTILS目录
/var/www/html/HDP-UTILS/centos7/1.1.0.22


#如果上面的目录中没有repodata,则在上面的路径下执行
createrepo .

16、在mysql中创建ambari用户

在my-hdp1上执行

#登录mysql
mysql -uroot -proot
#创建ambari用户
create user 'ambari'@'%' identified by 'ambari';
#授权ambari用户所有权限并设置本地登录
grant all privileges on *.* to 'ambari'@'localhost' identified by 'ambari';
#授权ambari用户所有权限并设置远程登录
grant all privileges on *.* to 'ambari'@'%' identified by 'ambari';
#刷新权限
flush privileges;
#退出登录
exit;
#使用ambari用户登录,检查ambari是否可以登录
mysql -uambari -pambari
#使用ambari用户登录并创建数据库
create database ambari;

17、初始化ambari数据库

在my-hdp1上执行

#使用amabri用户登录Mysql
mysql -uambari -pambari
#切换数据库
use ambari;
#初始化ambari数据库
source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql

18、安装ambari

在my-hdp1上执行

安装ambari-server
yum install ambari-server
#修改ambari.properties
vim /etc/ambari-server/conf/ambari.properties
#在ambari.properties文件末尾添加mysql-connector-java驱动
server.jdbc.driver.path=/var/share/java/mysql-connector-java-5.1.27-bin.jar
#ambari-server初始化配置
ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java-5.1.27-bin.jar

19、ambari配置

在my-hdp1上执行

[root@my-hdp1 java]# ambari-server setup
Using python  /usr/bin/python
Setup ambari-server
Checking SELinux...
SELinux status is 'enabled'
SELinux mode is 'permissive'
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)? y
Enter user account for ambari-server daemon (sweet):root
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] 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: 
Property cannot be blank.
Path to JAVA_HOME: /home/sweet/jdk1.8.0_144
Validating JDK on Ambari Server...done.
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
Hostname (localhost): 
Port (3306): 
Database name (ambari): 
Username (ambari): 
Enter Database Password (ambari): 
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)? n
WARNING: Remote database setup aborted.
Ambari Server 'setup' completed with warnings.
[root@my-hdp1 java]# ambari-server setup
Using python  /usr/bin/python
Setup ambari-server
Checking SELinux...
SELinux status is 'enabled'
SELinux mode is 'permissive'
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)? y
Enter user account for ambari-server daemon (sweet):root
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] 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: /home/sweet/jdk1.8.0_144
Validating JDK on Ambari Server...done.
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
Hostname (localhost): 
Port (3306): 
Database name (ambari): 
Username (ambari): 
Enter Database Password (ambari): 
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)? y
Extracting system views...
ambari-admin-2.6.2.2.1.jar
...........
Adjusting ambari-server permissions and ownership...
Ambari Server 'setup' completed successfully.

20、启动ambari

#启动ambari
ambari-server start
#启动成功后
在windows浏览器地址栏中输入
http://my-hdp1:8080/

对于全网详细的VSCode教程,以下是一个简短的描述: 全网详细的VSCode教程应该包含以下内容:基本介绍、安装和设置、编辑器布局、常用快捷键、实用插件和扩展、调试功能、版本控制、代码片段等。 在基本介绍部分,应该详细介绍VSCode是什么,它的优点和特点,如何下载和安装等。 安装和设置部分应该涵盖不同操作系统上的安装步骤和注意事项。同时,还应该介绍不同配置选项,如主题、字体、缩进设置等。 编辑器布局部分应该解释各个面板和视图的作用,如侧边栏、编辑窗口、终端等。详细说明如何调整布局以优化工作流程。 常用快捷键部分应该列举常用的快捷键和相关操作,如快速打开文件、搜索、查看定义等。应该对不同功能区分操作系统进行说明。 实用插件和扩展部分应该介绍一些常见和有用的插件,如代码片段、代码格式化、调试器等。应该详细解释如何安装和使用这些插件。 调试功能部分应该详细介绍如何配置和使用调试器,包括设置断点、查看变量的值等。 版本控制部分应该介绍如何使用内置的版本控制工具,如Git,如何提交、推送和拉取代码等。 最后,代码片段部分应该教授如何创建和使用代码片段,以提高编码效率。 以上仅是对全网详细的VSCode教程的一些简要描述。当然,真正最详细的教程可能比这个更加全面和详细,具体内容可能还包括更多高级功能和技巧。
评论 22
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

罗少说

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值