【记录】安装hive过程遇到的问题
1、hadoop安装不做赘述;
2、安装hive:
①下载hive**.tar.gz到指定位置:
wget http://mirror.bit.edu.cn/apache/hive/hive-2.3.6/apache-hive-2.3.6-bin.tar.gz
②解压:
tar -xvf apache-hive-2.3.6-bin.tar.gz
③配置/etc/profile:
export HIVE_HOME=/usr/local/apache-hive-2.3.6
export CLASSPATH=:${HIVE_HOME}/lib
export PATH=$PATH:$HIVE_HOME/bin
source /etc/profile
④新建文件:
sudo mkdir /tmp
sudo chmod 770 /tmp
mkdir /home/jyy/hive/warehouse
chmod 770 /home/jyy/hive/warehouse
⑤配置hive相关:
cd $HIVE_HOME/conf
cp hive-default.xml.template hive-default.xml
cp hive-log4j2.properties.template hive-log4j2.properties
sudo vim hive-site.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/home/jyy/hive/warehouse</value>
<description>location of default database for the warehouse</description>
</property>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost:3306/hive?characterEncoding=UTF-8&reateDatabaseIfNotExist=true&useSSL=false</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>hive</value>
</property>
</configuration>
报错之旅:
①初始化数据库时报错:[Fatal Error] hive-site.xml:11:93: The reference to entity "createDatabaseIfNotExist" must end with the ';' delimiter.
cd $HIVE_HOME/lib
schematool -dbType mysql -initSchema
这是因为xml文件中的编码规则引起的。
在xml文件中有以下几类字符要进行转义替换如下表所示:
所以javax.jdo.option.ConnectionURL项中的&符号需要用&表示。
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost:3306/hive?characterEncoding=UTF-8&reateDatabaseIfNotExist=true&useSSL=false</value>
<description>location of default database for the warehouse</description>
</property>
版权声明:本文为weixin_42130167原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。