大家好,欢迎来到IT知识分享网。
hive安装包下载及安装
在安装hive之前,请确保服务器已安装hadoop以及mysql!
hadoop安装
请自行去Hive官网下载apache-hive-3.1.2-bin.tar.gz
把apache-hive-3.1.2-bin.tar.gz解压到指定路径
tar zxvf apache-hive-3.1.2-bin.tar.gz -C /usr/local/hive-3.1.2/
IT知识分享网
环境变量配置
IT知识分享网vi /etc/profile
加入下面配置:
export HIVE_HOME=/usr/local/hive-3.1.2/
export PATH=$PATH:$HIVE_HOME/bin;
让配置生效:
IT知识分享网source /etc/profile
配置hive文件
cd /usr/local/hive-3.1.2/conf
把初始化的配置文件 复制一份出来 并且改名
cp hive-env.sh.template hive-env.sh
cp hive-default.xml.template hive-site.xml
cp hive-log4j2.properties.template hive-log4j2.properties
cp hive-exec-log4j2.properties.template hive-exec-log4j2.properties
配置hive-env.sh
vi hive-env.sh
加入下面配置:
# Set HADOOP_HOME to point to a specific hadoop install directory
export HADOOP_HOME=/usr/local/hadoop-3.2.2/ #hadoop安装路径
# Hive Configuration Directory can be controlled by:
export HIVE_CONF_DIR=/usr/local/hive-3.1.2/conf/ #hive路径
# Folder containing extra ibraries required for hive compilation/execution can be controlled by:
export HIVE_AUX_JARS_PATH=/usr/local/hive-3.1.2/lib/ #hivejar包路径
配置hive-site.xml文件
首先使用hadoop创建3个文件夹
hadoop fs -mkdir -p /user/hive/warehouse
hadoop fs -mkdir -p /user/hive/tmp
hadoop fs -mkdir -p /user/hive/log
修改文件夹权限
hadoop fs -chmod -R 777 /user/hive/warehouse
hadoop fs -chmod -R 777 /user/hive/tmp
hadoop fs -chmod -R 777 /user/hive/log
开始配置hive–site.xml
vi hive-site.xml
在标签加入下面配置:
<configuration>
<property>
<name>system:java.io.tmpdir</name>
<value>/home/hadoop/apps/hive/tmp</value>
</property>
<property>
<name>system:user.name</name>
<value>hive</value>
</property>
<property>
<name>hive.exec.scratchdir</name>
<value>/user/hive/tmp</value>
</property>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
</property>
<property>
<name>hive.querylog.location</name>
<value>/user/hive/log</value>
</property>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://172.18.111.104: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.cj.jdbc.Driver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
<description>username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>password</value>
<description>password to use against metastore database</description>
</property>
<property>
<name>datanucleus.schema.autoCreateAll</name>
<value>true</value> </property>
<property>
<name>hive.metastore.schema.verification</name>
<value>false</value>
</property>
初始化数据库
schematool -dbType mysql -initSchema
启动Hive
cd /usr/local/hive-3.1.2/bin
./hive
进行简单的验证:
show databases;
至此,Hive就安装成功了.
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/6181.html