这篇文章将为大家详细讲解有关hive-1.1.0-cdh5.7.0如何安装,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
创新互联公司主要从事成都网站设计、做网站、网页设计、企业做网站、公司建网站等业务。立足成都服务保亭黎族,10多年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:13518219792
环境说明:
1、VM10虚拟机
2、系统:centos6.5
3、Hadoop:hadoop-2.6.0-cdh6.7.0
4、JDK:jdk1.8.0_45
5、Maven:apache-maven-3.3.9
6、MySQL:mysql-5.6.39
1. 将编译好的tar包apache-hive-1.1.0-cdh6.7.0-bin.tar.gz 解压缩到~/app/ 下面:
[hadoop@hadoop002 target]$ tar -zxvf apache-hive-1.1.0-cdh6.7.0-bin.tar.gz -C ~/app/
[hadoop@hadoop002 app]$ ll
total 12
drwxrwxr-x. 8 hadoop hadoop 4096 Jun 1 16:41 apache-hive-1.1.0-cdh6.7.0-bin
drwxr-xr-x. 16 hadoop hadoop 4096 May 31 14:17 hadoop-2.6.0-cdh6.7.0
2. 将apache-hive-1.1.0-cdh6.7.0-bin重命名hive-1.1.0-cdh6.7.0:
[hadoop@hadoop002 app]$ mv apache-hive-1.1.0-cdh6.7.0-bin hive-1.1.0-cdh6.7.0
[hadoop@hadoop002 app]$ ll
total 12
drwxrwxr-x. 8 hadoop hadoop 4096 Jun 1 16:41 hive-1.1.0-cdh6.7.0
drwxr-xr-x. 16 hadoop hadoop 4096 May 31 14:17 hadoop-2.6.0-cdh6.7.0
3. 配置环境变量:
[hadoop@hadoop002 app]$ vi ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
export HIVE_HOME=/home/hadoop/app/hive-1.1.0-cdh6.7.0
export PATH=$HIVE_HOME/bin:$PATH
#保存退出
4. 环境变量生效
[hadoop@hadoop002 bin]$ . ~/.bash_profile
5. 上传MySQL驱动包(我用的是mysql-connector-java-5.1.7-bin.jar驱动包)到$HIVE_HOME/lib目录下:
[hadoop@hadoop002 lib]$ pwd
/home/hadoop/app/hive-1.1.0-cdh6.7.0/lib
[hadoop@hadoop002 lib]$ ll mysql-connector-java-5.1.7-bin.jar
-rw-r--r--. 1 hadoop hadoop 709922 May 31 16:56 mysql-connector-java-5.1.7-bin.jar
6. 创建配置文件hive-env.sh并修改:
[hadoop@hadoop002 hive-1.1.0-cdh6.7.0]$ cd conf
[hadoop@hadoop002 conf]$ pwd
/home/hadoop/app/hive-1.1.0-cdh6.7.0/conf
[hadoop@hadoop002 conf]$ ll
total 24
-rw-r--r--. 1 hadoop hadoop 1196 Mar 24 2016 beeline-log4j.properties.template
-rw-r--r--. 1 hadoop hadoop 2378 Mar 24 2016 hive-env.sh.template
-rw-r--r--. 1 hadoop hadoop 2662 Mar 24 2016 hive-exec-log4j.properties.template
-rw-r--r--. 1 hadoop hadoop 3505 Mar 24 2016 hive-log4j.properties.template
-rw-rw-r--. 1 hadoop hadoop 773 Jun 1 13:58 hive-site.xml
[hadoop@hadoop002 conf]$ cp hive-env.sh.template hive-env.sh
[hadoop@hadoop002 conf]$ chmod +x hive-env.sh
[hadoop@hadoop002 conf]$ ll
total 24
-rw-r--r--. 1 hadoop hadoop 1196 Mar 24 2016 beeline-log4j.properties.template
-rwxr-xr-x. 1 hadoop hadoop 2557 Jun 1 13:54 hive-env.sh
-rw-r--r--. 1 hadoop hadoop 2378 Mar 24 2016 hive-env.sh.template
-rw-r--r--. 1 hadoop hadoop 2662 Mar 24 2016 hive-exec-log4j.properties.template
-rw-r--r--. 1 hadoop hadoop 3505 Mar 24 2016 hive-log4j.properties.template
-rw-rw-r--. 1 hadoop hadoop 773 Jun 1 13:58 hive-site.xml
#添加如下配置:
HADOOP_HOME=/home/hadoop/app/hadoop-2.6.0-cdh6.7.0
7. 创建 hive-site.xml文件(因为hadoop-2.6.0-cdh6.7.0/conf下面没有hive-site.xml文件,需要手动创建):
[hadoop@hadoop000 conf]$ vi hive-site.xml
javax.jdo.option.ConnectionURL
jdbc:mysql://localhost:33066/ruozedb?createDatabaseIfNotExist=true
javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver
javax.jdo.option.ConnectionUserName
root
javax.jdo.option.ConnectionPassword
root
8. 执行hive命令:
[hadoop@hadoop002 hive-1.1.0-cdh6.7.0]$ cd bin
[hadoop@hadoop002 bin]$ pwd
/home/hadoop/app/hive-1.1.0-cdh6.7.0/bin
[hadoop@hadoop002 bin]$ ./hive
which: no hbase in (/home/hadoop/app/hive-1.1.0-cdh6.7.0/bin:/home/hadoop/app/hadoop-2.6.0-cdh6.7.0/bin:/opt/software/findbugs-1.3.9/bin:/usr/local/protobuf/bin:/opt/software/apache-maven-3.3.9/bin:/usr/java/jdk1.8.0_45/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/mysql/bin::/home/hadoop/bin)
Logging initialized using configuration in jar:file:/home/hadoop/app/hive-1.1.0-cdh6.7.0/lib/hive-common-1.1.0-cdh6.7.0.jar!/hive-log4j.properties
WARNING: Hive CLI is deprecated and migration to Beeline is recommended.
hive>
# 查看MySQL数据库:
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| ruozedb |
| test |
+--------------------+
5 rows in set (0.05 sec)
mysql> use ruozedb;
Database changed
mysql> show tables;
+---------------------------+
| Tables_in_ruozedb |
+---------------------------+
| bucketing_cols |
| cds |
| columns_v2 |
| database_params |
| dbs |
| func_ru |
| funcs |
| global_privs |
| idxs |
| part_col_stats |
| partition_key_vals |
| partition_keys |
| partitions |
| roles |
| sd_params |
| sds |
| sequence_table |
| serde_params |
| serdes |
| skewed_col_names |
| skewed_col_value_loc_map |
| skewed_string_list |
| skewed_string_list_values |
| skewed_values |
| sort_cols |
| tab_col_stats |
| table_params |
| tbls |
| version |
+---------------------------+
29 rows in set (0.00 sec)
mysql>
关于“hive-1.1.0-cdh5.7.0如何安装”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。