linux hive安装步骤
时间: 2023-11-22 12:49:35 浏览: 99
hive安装步骤
以下是在Linux上安装Hive的步骤:
1.确保已经安装了Java和Hadoop,并且已经启动了Hadoop集群和MySQL服务。
2.下载Hive压缩包并解压缩:
```shell
wget https://mirrors.tuna.tsinghua.edu.cn/apache/hive/hive-3.1.2/apache-hive-3.1.2-bin.tar.gz
tar -zxvf apache-hive-3.1.2-bin.tar.gz
```
3.将Hive配置文件复制到Hive目录下:
```shell
cd apache-hive-3.1.2-bin/conf
cp hive-env.sh.template hive-env.sh
cp hive-default.xml.template hive-site.xml
```
4.编辑hive-env.sh文件,设置JAVA_HOME和HADOOP_HOME:
```shell
export HADOOP_HOME=/usr/local/hadoop
export HIVE_CONF_DIR=/usr/local/hive/conf
export JAVA_HOME=/usr/local/java
```
5.编辑hive-site.xml文件,设置Hive的元数据存储位置和MySQL连接信息:
```shell
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</value>
<description>JDBC connect string for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive</value>
<description>username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>hive</value>
<description>password to use against metastore database</description>
</property>
```
6.将MySQL的JDBC驱动程序复制到Hive的lib目录下:
```shell
cp /usr/share/java/mysql-connector-java.jar /usr/local/hive/lib/
```
7.启动Hive:
```shell
cd /usr/local/hive/bin
./hive
```
阅读全文