安装ambari环境

# 查看 iptables 状态
service iptables status
(active 表示开启, inactive 表示没有开启)
# 停止防火墙
service iptables stop
# 永久关闭防火墙
chkconfig iptables off

# 查看防火墙状态
firewall-cmd --state
(not running 表示防火墙未开启, running 表示防火墙开启)
# 关闭防火墙
systemctl stop firewalld
# 永久关闭防火墙
systemctl disable firewalld
# 进入配置文件
vim /etc/selinux/config
# 将 SELINUX 改为 disable
SELINUX=disabled
yum -y install wget
wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
yum localinstall -y mysql57-community-release-el7-7.noarch.rpm
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
yum install -y mysql-community-server
# 添加远程用户
grant all privileges on *.* to 'root'@'%' identified by 'yourPassword';(若报错,修改为两句)

# 创建 ambari 库,并添加相应的用户
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'@'hadoop-node12' IDENTIFIED BY 'ambari';  
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'hadoop-node12';
FLUSH PRIVILEGES;

# 生成 ambari 需要使用到的表
source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
# 检查是否生成成功,共有 111 张表
show tables;
配置 ambari-server(主服务器)
# 启动 ambari-server 的配置程序
ambari-server setup

# 提示是否自定义设置。输入:y
Customize user account for ambari-server daemon [y/n] (n)? y
# ambari-server 账号,输入 ambari
Enter user account for ambari-server daemon (root):ambari
# 检查防火墙是否关闭,输入:y
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)? y
# 设置JDK。输入:y  2
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

# echo $JAVA_HOME
Path to JAVA_HOME: /usr/lib/jvm/java-1.8.0

# 是否要安装如下插件,输入:n
Enable Ambari Server to download and install GPL Licensed LZO packages [y/n] (n)? n
# 数据库配置。输入:y
Enter advanced database configuration [y/n] (n)? y
# 选择数据库,输入:3
Configuring database...
==============================================================================
Choose one of the following options:
[1] - PostgreSQL (Embedded)
[2] - Oracle
[3] - MySQL
[4] - PostgreSQL
[5] - Microsoft SQL Server (Tech Preview)
[6] - SQL Anywhere
==============================================================================
Enter choice (3): 3

# 设置数据库的具体配置信息
Hostname (localhost):
Port (3306):
Database name (ambari):
Username (ambari):
Enter Database Password (bigdata):ambari
Re-Enter password: ambari

# 是否使用如下驱动,输入:y
Should ambari use existing default jdbc /usr/share/java/mysql-connector-java.jar [y/n] (y)? y

# 将Ambari数据库脚本导入到数据库,输入:y
Proceed with configuring remote database connection properties [y/n] (y)? y
# 启动 ambari-server
ambari-server start

# 如果显示没有错误,则启动成功,如果报错,则输入下列命令查看日志
cat /var/log/ambari-server/ambari-server.log

# 指定数据库驱动
ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
安装 ambari-agent(所有节点)
所有节点安装 ambari-agent:
yum -y install ambari-agent
启动 ambari-agent:
ambari-agent start
添加 ambari-agent:
chkconfig --add ambari-agent

问题:centos7 ambari启动成功,但不能在页面显示。
解决方法:
1、# nproc
得到数字后,

vi /etc/ambari-server/conf/ambari.properties

找到其中的client.threadpool.size.max=25,把其中等号后面的数字替换成刚才执行nproc命令所获得的数字,保存后,重启ambari。

2、

netstat -tnlp | grep java

如果是在tcp上的话就是对的,如果是在tcp6上的话就得就禁用ipv6,vi /etc/sysctl.conf ,加入

net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1

3、输入命令:

systemctl list-unit-files|grep enabled

在这里插入图片描述解决方法:

systemctl stop firewalld.service
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
报错如下:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'identified by  'password' with grant option'

原因分析 :高版本的MySQL把将创建账户和赋予权限分开了。
解决方法:分开执行

创建账户:create user 'root'@'%' identified by '123456';
赋予权限:grant all privileges on *.* to 'root'@'%' with grant option;
刷新:flush privileges;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值