基於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成功后會自動跳轉到主界面