hive-2.3.3安装

1、下载hive-2.3.3

  下载地址 http://archive.apache.org/dist/hive/hive-2.3.3

  解压,编辑/etc/profile添加HIVE_HOME,保存文件,执行source /etc/profile命令,使修改生效。

2、准备MySQL数据库

  启动MySQL数据库,下载MySQL jdbc驱动,放入到$HIVE_HOME/lib下

3、修改配置文件

  编辑hive-env.sh文件,添加

  export HADOOP_HOME=/home/hadoop/hadoop-2.7.5
  export HIVE_CONF_DIR=/home/hadoop/hive-2.3.3/conf
  export HIVE_AUX_JARS_PATH=/home/hadoop/hive-2.3.3/lib

  修改hive-site.xml文件

  

<property>

 <name>javax.jdo.option.ConnectionURL</name>

  <value>jdbc:mysql://mysql server IP/hive_meta?createDatabaseIfNotExist=true</value>

  <description>JDBC connect string for aJDBC metastore</description>

</property>

<property>

 <name>javax.jdo.option.ConnectionDriverName</name>

 <value>com.mysql.jdbc.Driver</value>

  <description>Driver class name for aJDBC metastore</description>

</property>

<property>

 <name>javax.jdo.option.ConnectionUserName</name>

  <value>hive</value>

  <description>username to use againstmetastore database</description>

</property>

<property>

  <name>javax.jdo.option.ConnectionPassword</name>

  <value>hive</value>

  <description>password to use againstmetastore database</description>

</property>

执行命令启动metastore 

./hive --service metastore &   (加&为后台启动)

可能会报错

1、Exception in thread "main" java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D

  修改hive-site.xml所有 ${system:java.io.tmpdir} 改为自定义路径

2、MetaException(message:Version information not found in metastore. )

  此属性改为false。

  <property>

    <name>hive.metastore.schema.verification</name>

    <value>false</value>
  </property>

3、MetaException(message:Required table missing : "`DBS`" in Catalog "" Schema "". DataNucleus requires this table to perform its persistence operations. Either your MetaData is incorrect, or you need to enable "datanucleus.schema.autoCreateTables")

  将datanucleus.schema.autoCreateAll属性改为true。

再次启动metastore,成功,查看MySQL数据库,数据库和hive元数据表都已创建成功

4、启动hiveserver2

  ./hive --service hiveserver2

  执行后不会跟metastore执行一样会将日志直接输出到控制台,验证是否启动成功,可以netstat -anp|grep 10000,或查看hive的启动日志,默认/tmp/启动hive的linux用户名/hive.log。

  如果日志文件中没有异常日志,表明启动成功,此时文件末尾会有hive server已经启动的日志,如图:

如果有异常日志,百度查看解决办法。。。

原文地址:https://www.cnblogs.com/cuipengbo/p/9272112.html