您好,登錄后才能下訂單哦!
這篇文章將為大家詳細講解有關hive-1.1.0-cdh5.7.0如何安裝,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。
環境說明:
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如何安裝”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,使各位可以學到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。