九阴真经Ambari——3.安装并配置MariaDB
作者:互联网
转载请注明出处:https://yuhaidong.blog.csdn.net//article/details/86693553
本文出自【我是干勾鱼的博客】
Ingredients:
-
Java:Java SE Development Kit 8u162(Oracle Java Archive),Linux下安装JDK修改环境变量
-
Ambari/HDP:Ambari 2.7.3 Repositories,HDP 3.1.0 Repositories(Apache Ambari-2.7.3.0 Installation,Support Matrix,Hortonworks)
HDP在运行的时候需要用到数据库存放元数据等信息,正如官方文档在Using an existing or installing a default database中所说:
Ambari installs the PostgreSQL, MySQL, and Derby databases for use with Ambari, Hive, and Oozie respectively, as default options. You may instead use a new, or an existing, non-default database instance with these components.
当然可以使用Ambari默认安装的几个数据库,但一般来说会使用MySQL/MariaDB作为数据库使用。这里使用MariaDB。
1 安装MariaDB
鉴于Ambari目前的最新版本:
Ambari 2.7.3
HDP 3.1.0
在Support Matrix中对MariaDB的版本要求是:
MariaDB 10.2
这里就使用MariaDB 10.2.21来安装,可以参考弹指神通MariaDB——CentOS 7.4上安装MariaDB 10.2.21的二进制版本
2 配置MariaDB
配置MariaDB的过程主要是在MariaDB中执行一些官方的数据库脚本,以及创建一些安装软件所需要用到的user、group等。
2.1 Ambari数据配置
2.1.1 指定JDBC的jar位置
2.1.1.1 下载MySQL驱动
Download Connector/J,可以下载Connector/J 5.1.47 - Platform Independent (Architecture Independent),例如mysql-connector-java-5.1.47.zip。
2.1.1.2 执行脚本命令
执行命令:
ambari-server setup --jdbc-db=mysql --jdbc-driver=/path/to/mysql/mysql-connector-java.jar
2.1.1.3 确认位置
确保jar已经被复制到共享目录:
ls -al /usr/share/java/mysql-connector-java.jar
2.1.1.4 确认权限
确保其权限为644。
2.1.2 创建Ambari的user
使用root登录mysql:
mysql -u root -p
执行脚本:
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'@'shizhi004' IDENTIFIED BY 'ambari';
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'shizhi004';
2.1.3 创建DATABASE及执行官方脚本
使用Ambari用户登录:
mysql -u ambari -p
执行:
CREATE DATABASE ambari;
USE ambari;
SOURCE /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql;
2.2 Hive的数据配置
2.2.1 指定JDBC的jar位置
2.2.1.1 运行1
ambari-server setup --jdbc-db=mysql --jdbc-driver=/path/to/mysql/mysql-connector-java.jar
2.2.1.2 确认
ls /usr/share/java/mysql-connector-java.jar
2.2.1.3 权限
权限设为644。
2.2.1.4 运行2
ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
2.2.2 创建Hive的user
root登录:
mysql -u root -p
执行:
CREATE USER 'hive'@'localhost' IDENTIFIED BY '123456Aaa';
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'localhost';
CREATE USER 'hive'@'%' IDENTIFIED BY '123456Aaa';
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%';
CREATE USER 'hive'@'shizhi004' IDENTIFIED BY '123456Aaa';
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'shizhi004';
2.2.2 创建Hive的database
root登录:
mysql -u root -p
创建database:
CREATE DATABASE hive;
2.3 Oozie数据配置
同2.2。
2.4 druid的数据配置
同2.2。
2.5 ranger的数据配置
同2.2。
2.6 rangerkms的数据配置
同2.2。
3 汇总脚本
3.1 user
CREATE USER 'ambari'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'%';
CREATE USER 'ambari'@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'localhost';
CREATE USER 'ambari'@'shizhi004' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'shizhi004';
CREATE USER 'hive'@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'localhost';
CREATE USER 'hive'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%';
CREATE USER 'hive'@'shizhi004' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'shizhi004';
CREATE USER 'oozie'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'oozie'@'%';
CREATE USER 'oozie'@'shizhi004' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'oozie'@'shizhi004';
CREATE USER 'druid'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'druid'@'%';
CREATE USER 'druid'@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'druid'@'localhost';
CREATE USER 'druid'@'shizhi004' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'druid'@'shizhi004';
CREATE USER 'ranger'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'ranger'@'%';
CREATE USER 'ranger'@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'ranger'@'localhost';
CREATE USER 'ranger'@'shizhi004' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'ranger'@'shizhi004';
CREATE USER 'rangerkms'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'rangerkms'@'%';
CREATE USER 'rangerkms'@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'rangerkms'@'localhost';
CREATE USER 'rangerkms'@'shizhi004' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'rangerkms'@'shizhi004';
FLUSH PRIVILEGES;
3.2 database
CREATE DATABASE ambari;
CREATE DATABASE hive;
CREATE DATABASE oozie;
CREATE DATABASE druid;
CREATE DATABASE ranger;
CREATE DATABASE rangerkms;
3.3 说明
注意! 使用的时候还是按产品对应的执行脚本,而不要放在一起执行,这里将脚本放到了一起主要是为了查阅方便。
4 参考
Using an existing or installing a default database
基于【CentOS-7+ Ambari 2.7.0 + HDP 3.0】搭建HAWQ数据仓库02 ——使用ambari-server安装HDP
基于【CentOS-7+ Ambari 2.7.0 + HDP 3.0】搭建HAWQ数据仓库01 —— 准备环境,搭建本地仓库,安装ambari
标签:Ambari,GRANT,九阴真经,CREATE,IDENTIFIED,USER,ambari,MariaDB,PRIVILEGES 来源: https://blog.csdn.net/dongdong9223/article/details/86693553