Hive-2.3.7安装(实际上是3.1.2)
官网下载tar.gz
https://mirrors.koehn.com/apache/hive/hive-2.3.7/
解压到指定目录
tar -zxvf apache-hive-2.3.7-bin.tar.gz -C …/software/
cd …/software
mv apache-hive-2.3.7-bin/ hive-2.3.7
cd hive-2.3.7/conf
vim hive-site.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://mysql所在IP地址:3306/hivemetastore?createDatabaseIfNotExist=true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>mysql账号</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>mysql密码</value>
</property>
<property>
<name>hive.cli.print.current.db</name>
<value>true</value>
</property>
<property>
<name>hive.cli.print.header</name>
<value>true</value>
</property>
<!-- 绑定运行hiveServer2的主机host,默认localhost -->
<property>
<name>hive.server2.thrift.bind.host</name>
<value>yts1</value>
</property>
<!-- 指定hive metastore服务请求的uri地址 -->
<property>
<name>hive.metastore.uris</name>
<value>thrift://yts1:9083</value>
</property>
</configuration>
下载连接mysql的jar包
https://mvnrepository.com/artifact/mysql/mysql-connector-java/5.1.37
将jar包放到hive的lib目录中
vim /etc/profile
export HIVE_HOME=/new/software/hive-2.3.7
export PATH=$PATH:$HIVE_HOME/bin
source /etc/profile
初始化hive
schematool -dbType mysql -initSchema
替换guava
因为我的hadoop版本是3.3.0,guava的版本不一致,会报错,只需要删除hive/lib中的低版本的guava,把hadoop中高版本的guava放在hive的lib中就ok了
warning
我的hive是2.3.7 ,hadoop是3.3.0 ,可能是版本不兼容吧,导致最后没法用,最后换了hive 3.1.2的版本,可以使用了