基于Ambari的WebUI部署Hive服务
作者:尹正杰
版权声明:原创作品,谢绝转载!否则将追究法律责任。
一.部署Ambari服务
博主推荐阅读: https://www.cnblogs.com/yinzhengjie2020/p/12227503.html
二.创建Hive的元数据信息
1>.MySQL 8.x以上版本需要确认的配置文件密码策略
[root@hdp101.yinzhengjie.org.cn ~]# egrep -v "^#|^$" /etc/my.cnf [mysqld] validate_password.policy=LOW innodb_file_format=BARRACUDA innodb_large_prefix=true innodb_default_row_format=DYNAMIC character-set-server=utf8mb4 collation-server=utf8mb4_unicode_ci datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid [root@hdp101.yinzhengjie.org.cn ~]# [root@hdp101.yinzhengjie.org.cn ~]# grep validate_password.policy /etc/my.cnf validate_password.policy=LOW [root@hdp101.yinzhengjie.org.cn ~]#
2>.MySQL授权用户
[root@hdp101.yinzhengjie.org.cn ~]# mysql -uroot -pyinzhengjie mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 29 Server version: 8.0.19 MySQL Community Server - GPL Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. mysql> mysql> CREATE DATABASE hive DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; Query OK, 1 row affected (0.00 sec) mysql> mysql> CREATE USER 'hive'@'172.200.1.%' IDENTIFIED BY 'yinzhengjie'; Query OK, 0 rows affected (0.00 sec) mysql> mysql> mysql> CREATE USER 'hive'@'hdp101.yinzhengjie.org.cn' IDENTIFIED BY 'yinzhengjie'; Query OK, 0 rows affected (0.01 sec) mysql> mysql> SELECT user,host FROM mysql.user; +------------------+---------------------------+ | user | host | +------------------+---------------------------+ | ambari | % | | hive | 172.200.1.% | | hive | hdp101.yinzhengjie.org.cn | | mysql.infoschema | localhost | | mysql.session | localhost | | mysql.sys | localhost | | root | localhost | +------------------+---------------------------+ 7 rows in set (0.00 sec) mysql> mysql> SHOW GRANTS FOR 'hive'@'172.200.1.%'; +--------------------------------------------+ | Grants for hive@172.200.1.% | +--------------------------------------------+ | GRANT USAGE ON *.* TO `hive`@`172.200.1.%` | +--------------------------------------------+ 1 row in set (0.00 sec) mysql> mysql> GRANT ALL ON hive.* TO 'hive'@'172.200.1.%'; Query OK, 0 rows affected (0.00 sec) mysql> mysql> SHOW GRANTS FOR 'hive'@'172.200.1.%'; +----------------------------------------------------------+ | Grants for hive@172.200.1.% | +----------------------------------------------------------+ | GRANT USAGE ON *.* TO `hive`@`172.200.1.%` | | GRANT ALL PRIVILEGES ON `hive`.* TO `hive`@`172.200.1.%` | +----------------------------------------------------------+ 2 rows in set (0.00 sec) mysql> mysql> GRANT ALL ON hive.* TO 'hive'@'hdp101.yinzhengjie.org.cn'; Query OK, 0 rows affected (0.00 sec) mysql> mysql> SHOW GRANTS FOR 'hive'@'hdp101.yinzhengjie.org.cn'; +------------------------------------------------------------------------+ | Grants for hive@hdp101.yinzhengjie.org.cn | +------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO `hive`@`hdp101.yinzhengjie.org.cn` | | GRANT ALL PRIVILEGES ON `hive`.* TO `hive`@`hdp101.yinzhengjie.org.cn` | +------------------------------------------------------------------------+ 2 rows in set (0.00 sec) mysql> mysql> QUIT Bye [root@hdp101.yinzhengjie.org.cn ~]# [root@hdp101.yinzhengjie.org.cn ~]#
2>.测试MySQL授权用户的权限
[root@hdp101.yinzhengjie.org.cn ~]# mysql -uhive -pyinzhengjie -h 172.200.1.101
三.基于Ambari的WebUI部署HBase服务
1>.启动服务安装向导
2>.选择要添加的hive服务和Tez(如果不勾选Tez的话Ambari也会自动帮咱们勾选的,Tez服务是HDP要求咱们强制安装的~)
3>.配置Hive的源数据库信息
4>.勾选需要安装hive的客户端对应的主机
5>.Tez界面不做任何的配置修改,点击"HIVE"
6>.配置数据库的相关信息
7>.测试连接数据库时报错啦
resource_management.core.exceptions.Fail: Check db_connection_check was unsuccessful. Exit code: 1. Message: The MySQL JDBC driver has not been set. Please ensure that you have executed 'ambari-server setup --jdbc-db=mysql --jdbc-driver=/path/to/jdbc_driver'.
根据报错日志的提示,需要我们手动设置MySQL驱动,具体操作如下:
[root@hdp101.yinzhengjie.org.cn ~]# ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
8>.配置MySQL数据库连接信息并测试连接
测试连接数据库失败时,请仔细检查以下两项:
(1)测试连接MySQL的用户是否有权限登录;
(2)确认填写的MySQL配置信息是否有错误,尤其是MySQL的密码(因为密码内容被隐藏了不易被发现);
9>.暂时忽略警告信息,点击"PROCEED ANYWAY",即无论如何都继续
10>.Review之前的配置信息,确认无误后点击部署,即"DEPLOY"
11>.正在初始化任务
12>.等待Hive 客户端组件安装完毕
13>.等待启动HiveServer2服务,之后会安装Tez服务
14>.等待所有组件安装成功,点击下一步
15>.Hive服务安装成功
16>.安装Hive成功后会自动跳转到主界面