概述
环境说明:
1、VM10虚拟机
2、系统:centos6.5
3、Hadoop:hadoop-2.6.0-cdh5.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-cdh5.7.0-bin.tar.gz 解压缩到~/app/ 下面:
[hadoop@hadoop002 target]$ tar -zxvf apache-hive-1.1.0-cdh5.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-cdh5.7.0-bin
drwxr-xr-x. 16 hadoop hadoop 4096 May 31 14:17 hadoop-2.6.0-cdh5.7.0
2. 将apache-hive-1.1.0-cdh5.7.0-bin重命名hive-1.1.0-cdh5.7.0:
[hadoop@hadoop002 app]$ mv apache-hive-1.1.0-cdh5.7.0-bin hive-1.1.0-cdh5.7.0
[hadoop@hadoop002 app]$ ll
total 12
drwxrwxr-x. 8 hadoop hadoop 4096 Jun 1 16:41 hive-1.1.0-cdh5.7.0
drwxr-xr-x. 16 hadoop hadoop 4096 May 31 14:17 hadoop-2.6.0-cdh5.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-cdh5.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-cdh5.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-cdh5.7.0]$ cd conf
[hadoop@hadoop002 conf]$ pwd
/home/hadoop/app/hive-1.1.0-cdh5.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-cdh5.7.0
7. 创建 hive-site.xml文件(因为hadoop-2.6.0-cdh5.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-cdh5.7.0]$ cd bin
[hadoop@hadoop002 bin]$ pwd
/home/hadoop/app/hive-1.1.0-cdh5.7.0/bin
[hadoop@hadoop002 bin]$ ./hive
which: no hbase in (/home/hadoop/app/hive-1.1.0-cdh5.7.0/bin:/home/hadoop/app/hadoop-2.6.0-cdh5.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-cdh5.7.0/lib/hive-common-1.1.0-cdh5.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>
1、VM10虚拟机
2、系统:centos6.5
3、Hadoop:hadoop-2.6.0-cdh5.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-cdh5.7.0-bin.tar.gz 解压缩到~/app/ 下面:
[hadoop@hadoop002 target]$ tar -zxvf apache-hive-1.1.0-cdh5.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-cdh5.7.0-bin
drwxr-xr-x. 16 hadoop hadoop 4096 May 31 14:17 hadoop-2.6.0-cdh5.7.0
2. 将apache-hive-1.1.0-cdh5.7.0-bin重命名hive-1.1.0-cdh5.7.0:
[hadoop@hadoop002 app]$ mv apache-hive-1.1.0-cdh5.7.0-bin hive-1.1.0-cdh5.7.0
[hadoop@hadoop002 app]$ ll
total 12
drwxrwxr-x. 8 hadoop hadoop 4096 Jun 1 16:41 hive-1.1.0-cdh5.7.0
drwxr-xr-x. 16 hadoop hadoop 4096 May 31 14:17 hadoop-2.6.0-cdh5.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-cdh5.7.0
export PATH=$HIVE_HOME/bin:$PATH
#保存退出
4. 环境变量生效
[hadoop@hadoop002 bin]$ . ~/.bash_profile
[hadoop@hadoop002 lib]$ pwd
/home/hadoop/app/hive-1.1.0-cdh5.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-cdh5.7.0]$ cd conf
[hadoop@hadoop002 conf]$ pwd
/home/hadoop/app/hive-1.1.0-cdh5.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-cdh5.7.0
7. 创建 hive-site.xml文件(因为hadoop-2.6.0-cdh5.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-cdh5.7.0]$ cd bin
[hadoop@hadoop002 bin]$ pwd
/home/hadoop/app/hive-1.1.0-cdh5.7.0/bin
[hadoop@hadoop002 bin]$ ./hive
which: no hbase in (/home/hadoop/app/hive-1.1.0-cdh5.7.0/bin:/home/hadoop/app/hadoop-2.6.0-cdh5.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-cdh5.7.0/lib/hive-common-1.1.0-cdh5.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>
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29609890/viewspace-2155488/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29609890/viewspace-2155488/
最后
以上就是老迟到板凳为你收集整理的hive-1.1.0-cdh5.7.0 安装的全部内容,希望文章能够帮你解决hive-1.1.0-cdh5.7.0 安装所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复