Hive安装与应用过程
Posted ParamousGIS
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Hive安装与应用过程相关的知识,希望对你有一定的参考价值。
1. 参考说明
参考文档:
https://cwiki.apache.org/confluence/display/Hive/GettingStarted
2. 安装环境说明
2.1. 环境说明
CentOS7.4+ Hadoop2.7.5的伪分布式环境
主机名 |
NameNode |
SecondaryNameNode |
DataNodes |
centoshadoop.smartmap.com |
192.168.1.80 |
192.168.1.80 |
192.168.1.80 |
|
|
|
|
Hadoop的安装目录为:/opt/hadoop/hadoop-2.7.5
3. 安装
3.1. Hive下载
https://hive.apache.org/downloads.html
3.2. Hive解压
将下载的apache-hive-2.3.3-bin.tar.gz解压到/opt/hadoop/hive-2.3.3目录下
4. 配置
4.1. 修改profile文件
vi /etc/profile
export HIVE_HOME=/opt/hadoop/hive-2.3.3
export PATH=$PATH:$HIVE_HOME/bin
export CLASSPATH=$CLASSPATH:$HIVE_HOME/lib
4.2. 将JDK升级为1.8版本
将JDK切换成1.8的版本,并修改所有与JAVA_HOME相关的变量
4.3. 安装mysql数据库
4.3.1. 下载MySQL源
[root@centoshadoop soft]# wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
4.3.2. 安装MySQL源
[root@centoshadoop soft]# yum install mysql57-community-release-el7-8.noarch.rpm
4.3.3. 安装MySQL
[root@centoshadoop soft]# yum install mysql-server
4.3.4. 启动mysql服务
[root@centoshadoop soft]# systemctl start mysqld
[root@centoshadoop soft]# systemctl enable mysqld
4.3.5. 重置root密码
MySQL5.7会在安装后为root用户生成一个随机密码, MySQL为root用户生成的随机密码通过mysqld.log文件可以查找到
[root@centoshadoop soft]# grep \'temporary password\' /var/log/mysqld.log
2018-05-22T09:23:43.115820Z 1 [Note] A temporary password is generated for root@localhost: 2&?SYJpBOdwo
[root@centoshadoop soft]#
[ambari@master opt]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \\g.
Your MySQL connection id is 2
Server version: 5.7.22
…....
mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)
mysql> set global validate_password_length=3;
Query OK, 0 rows affected (0.00 sec)
mysql> set global validate_password_mixed_case_count=0;
Query OK, 0 rows affected (0.00 sec)
mysql> set global validate_password_number_count=0;
Query OK, 0 rows affected (0.00 sec)
mysql> set global validate_password_special_char_count=0;
Query OK, 0 rows affected (0.00 sec)
mysql> alter user \'root\'@\'localhost\' identified by \'gis123\';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> SHOW VARIABLES LIKE \'validate_password%\';
+--------------------------------------+-------+
| Variable_name | Value |
+--------------------------------------+-------+
| validate_password_check_user_name | OFF |
| validate_password_dictionary_file | |
| validate_password_length | 4 |
| validate_password_mixed_case_count | 0 |
| validate_password_number_count | 0 |
| validate_password_policy | LOW |
| validate_password_special_char_count | 0 |
+--------------------------------------+-------+
7 rows in set (0.01 sec)
mysql> set global validate_password_length=3;
Query OK, 0 rows affected (0.00 sec)
mysql> alter user \'root\'@\'localhost\' identified by \'gis\';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
[ambari@master opt]$ mysql -u root -p
Enter password:
4.3.6. 开放数据库访问权限
[root@localsource ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \\g.
……
Type \'help;\' or \'\\h\' for help. Type \'\\c\' to clear the current input statement.
mysql> GRANT ALL PRIVILEGES ON *.* TO \'root\'@\'%\' IDENTIFIED BY \'gis\' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> quit