Fork me on Gitee

Ambari配置MySQL数据库

1. 卸载默认postgre数据库

# 查找
rpm -qa |grep postgres
# 卸载
yum remove postgresql*

2.安装MySQL数据库

wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-server

3. 配置开机自启动

vi /etc/rc.local

#文件末尾添加service mysqld start
systemctl start mysqld

4.初始化MySQL

mysql -uroot -p


mysql> set password for 'root'@'localhost' = password('123456');
mysql> grant all privileges on *.* to 'root'@'%' identified by '123456';
mysql> CREATE USER 'ambari'@'%' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'%';
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE USER 'ambari'@'localhost' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'localhost';
Query OK, 0 rows affected (0.00 sec)
FLUSH PRIVILEGES;

5. 上传MySQL连接jar

scp -r mysql-connector-java-5.1.46.jar root@192.168.2.181:/root

6. 初始化Ambari-server并启动

[root@centos ~]# ambari-server setup
Using python  /usr/bin/python
Setup ambari-server
Checking SELinux...
SELinux status is 'disabled'
Customize user account for ambari-server daemon [y/n] (n)? n
Adjusting ambari-server permissions and ownership...
Checking firewall status...
Checking JDK...
[1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8
[2] Custom JDK
==============================================================================
Enter choice (1): 2
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/jdk_1.8
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...
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 (1): 3
Hostname (localhost): 192.168.2.174
Port (3306): 3306
Database name (ambari): ambari
Username (ambari): ambari
Enter Database Password (bigdata):
Re-enter password:
Configuring ambari database...
Enter full path to custom jdbc driver: /root/mysql-connector-java-5.1.46.jar
Copying /root/mysql-connector-java-5.1.46.jar to /usr/share/java
Configuring remote database connection properties...
WARNING: Before starting Ambari Server, you must run the following DDL directly from the database shell 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.7.5.0.72.jar
....
Ambari repo file doesn't contain latest json url, skipping repoinfos modification
Adjusting ambari-server permissions and ownership...
Ambari Server 'setup' completed successfully.

7. 导入Ambari初始化表结构

mysql> create database ambari;
mysql> use ambari;
mysql> source  /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql

8.启动Ambari-server

ambari-server restart
posted @ 2022-05-25 17:42  shine-rainbow  阅读(794)  评论(0编辑  收藏  举报