溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

Hive Install

發(fā)布時間:2020-07-18 12:51:25 來源:網(wǎng)絡(luò) 閱讀:220 作者:zjy1002261870 欄目:大數(shù)據(jù)

1、http://mirror.bit.edu.cn/apache/hive/stable-2/ 下載hive;上傳到linux系統(tǒng)

2、將apache-hive-2.3.3-bin.tar.gz移動到/usr/local目錄,解壓,并重命名為hive ;如下
[root@hmaster soft]# ls
apache-hive-2.3.3-bin.tar.gz hadoop-2.7.3.tar.gz jdk-8u151-linux-i586.tar.gz
[root@hmaster soft]# mv apache-hive-2.3.3-bin.tar.gz /usr/local/
[root@hmaster soft]# cd /usr/local/
[root@hmaster local]# ls
apache-hive-2.3.3-bin.tar.gz bin etc games hadoop include java lib lib64 libexec sbin share src
[root@hmaster local]# tar -xvf apache-hive-2.3.3-bin.tar.gz
[root@hmaster local]# mv apache-hive-2.3.3-bin hive
[root@hmaster local]# ls
bin etc games hadoop hive include java lib lib64 libexec sbin share src
[root@hmaster local]#
3、配置環(huán)境變量

[root@hmaster local]# vim /etc/profile
[root@hmaster local]# ^C
[root@hmaster local]# source /etc/profile
[root@hmaster local]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/java/jdk1.8.0_151/bin:/usr/local/hadoop/bin:/usr/local/hadoop/sbin:/root/bin:/usr/java/jdk1.8.0_151/bin:/usr/local/hadoop/bin:/usr/local/hadoop/sbin:/usr/local/hive/bin
[root@hmaster local]#

#set java environment /usr/local/java/jdk1.8.0_151
export JAVA_HOME=/usr/java/jdk1.8.0_151
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin

export PATH=$PATH:/usr/local/hadoop/bin:/usr/local/hadoop/sbin
export PATH=$PATH:/usr/local/hive/bin
4、配置hive-site.xml
[root@hmaster conf]# pwd
/usr/local/hive/conf
[root@hmaster conf]# ll
total 288
-rw-r--r--. 1 root root 1596 Feb 17 2017 beeline-log4j2.properties.template
-rw-r--r--. 1 root root 257573 Mar 28 2018 hive-default.xml.template
-rw-r--r--. 1 root root 2365 Feb 17 2017 hive-env.sh.template
-rw-r--r--. 1 root root 2274 Feb 17 2017 hive-exec-log4j2.properties.template
-rw-r--r--. 1 root root 2925 Mar 7 2018 hive-log4j2.properties.template
-rw-r--r--. 1 root root 2060 Feb 17 2017 ivysettings.xml
-rw-r--r--. 1 root root 2719 Mar 7 2018 llap-cli-log4j2.properties.template
-rw-r--r--. 1 root root 7041 Mar 7 2018 llap-daemon-log4j2.properties.template
-rw-r--r--. 1 root root 2662 Jul 20 2016 parquet-logging.properties
[root@hmaster conf]# cp hive-default.xml.template hive-site.xml

[root@hmaster hive]# pwd
/usr/local/hive
[root@hmaster hive]# mkdir tmp
[root@hmaster hive]# ls
bin binary-package-licenses conf examples hcatalog jdbc lib LICENSE NOTICE RELEASE_NOTES.txt scripts tmp

通過文件傳輸工具將hive-site.xml文件復(fù)制到window上編輯

<property>
<name>hive.metastore.schema.verification</name>
<value>false</value>
<description>
Enforce metastore schema version consistency.
True: Verify that version information stored in is compatible with one from Hive jars. Also disable automatic
schema migration attempt. Users are required to manually migrate schema after Hive upgrade which ensures
proper metastore schema migration. (Default)
False: Warn if the version information stored in metastore doesn't match with one from in Hive jars.
</description>
</property>

用創(chuàng)建的 /usr/local/hive/tmp 目錄,替換 ${system:java.io.tmpdir}
替換 ${system:user.name} 為root
上傳覆蓋文件hive-site.xml

在/usr/local/hive目錄下執(zhí)行如下命令
[root@hmaster hive]# pwd
/usr/local/hive
[root@hmaster hive]# schematool -initSchema -dbType derby

[root@hmaster hive]# ll
total 60
drwxr-xr-x. 3 root root 133 Oct 9 23:46 bin
drwxr-xr-x. 2 root root 4096 Oct 9 23:46 binary-package-licenses
drwxr-xr-x. 2 root root 4096 Oct 9 23:57 conf
-rw-r--r--. 1 root root 639 Oct 10 02:16 derby.log
drwxr-xr-x. 4 root root 34 Oct 9 23:46 examples
drwxr-xr-x. 7 root root 68 Oct 9 23:46 hcatalog
drwxr-xr-x. 2 root root 44 Oct 9 23:46 jdbc
drwxr-xr-x. 4 root root 12288 Oct 9 23:46 lib
-rw-r--r--. 1 root root 20798 Mar 7 2018 LICENSE
drwxr-xr-x. 5 root root 133 Oct 10 02:16 metastore_db
-rw-r--r--. 1 root root 230 Mar 27 2018 NOTICE
-rw-r--r--. 1 root root 459 Mar 28 2018 RELEASE_NOTES.txt
drwxr-xr-x. 4 root root 35 Oct 9 23:46 scripts
drwxr-xr-x. 2 root root 6 Oct 10 01:33 tmp

啟動hive命令: hive

schematool -initSchema -dbType derby
嘗試當(dāng)前目錄下初始化 metastore_db的數(shù)據(jù)庫
注意下次執(zhí)行hive時應(yīng)該在同一目錄,默認(rèn)到當(dāng)前目錄尋找metastore
遇到問題,把metastore_db 刪除,重新執(zhí)行命令schematool -initSchema -dbType derby
實(shí)際工作環(huán)境中,經(jīng)常使用MySQL作為metastore的數(shù)據(jù)庫

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI