温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Hive Install

发布时间:2020-07-18 12:51:25 来源:网络 阅读:227 作者:zjy1002261870 栏目:大数据

1、http://mirror.bit.edu.cn/apache/hive/stable-2/ 下载hive;上传到linux系统

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、配置环境变量

[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文件复制到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>

用创建的 /usr/local/hive/tmp 目录,替换 ${system:java.io.tmpdir}
替换 ${system:user.name} 为root
上传覆盖文件hive-site.xml

在/usr/local/hive目录下执行如下命令
[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
尝试当前目录下初始化 metastore_db的数据库
注意下次执行hive时应该在同一目录,默认到当前目录寻找metastore
遇到问题,把metastore_db 删除,重新执行命令schematool -initSchema -dbType derby
实际工作环境中,经常使用MySQL作为metastore的数据库

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI