微信搜索lxw1234bigdata | 邀请体验:数阅–数据管理、OLAP分析与可视化平台 | 赞助作者:赞助作者

记录一下Hive2.0安装配置遇到的问题

Hive lxw1234@qq.com 12257℃ 0评论

关键字: hive2.0

本文记录在尝试配置部署Hive2.0过程中遇到的一些问题。

Hive2.0的安装配置过程一样非常简单,和之前的版本没什么区别,具体可参考:http://lxw1234.com/archives/2015/06/269.htm

下载并解压apache-hive-2.0.0-bin.tar.gz,进入apache-hive-2.0.0-bin/conf,

cp hive-exec-log4j2.properties.template hive-exec-log4j2.properties

cp hive-env.sh.template hive-env.sh

另外,建立hive-site.xml,配置一些必要的参数,我这里直接将之前配置好的Hive0.13的hive-site.xml复制过来,修改了mysql的元数据库链接信息即可。

初次启动时,遇到以下两个问题:

1. MySQL驱动包

Caused by: org.datanucleus.store.rdbms.connectionpool.DatastoreDriverNotFoundException: 
The specified datastore driver ("com.mysql.jdbc.Driver") was not found in the CLASSPATH. 
Please check your CLASSPATH specification, and the name of the driver.

该问题非常简单,就是缺少MySQL驱动包,将其(如mysql-connector-java-5.1.15-bin.jar)拷贝到$HIVE_HOME/lib下即可。

2. 首次启动时候,元数据库的初始化。

Exception in thread "main" java.lang.RuntimeException: Hive metastore database is not initialized. 
Please use schematool (e.g. ./schematool -initSchema -dbType ...) to create the schema. If needed, 
don't forget to include the option to auto-create the underlying database in your JDBC connection string (e.g. ?createDatabaseIfNotExist=true for mysql)

错误提示已经很明显,首次启动时候,尽管在MySQL的连接URL中设置了createDatabaseIfNotExist=true,但还是提示不能自动初始化元数据库,
需要执行: $HIVE_HOME/bin/schematool -initSchema -dbType mysql

出现以下提示:

Metastore connection URL:        jdbc:mysql://192.168.1.102:3306/hive12?createDatabaseIfNotExist=true
Metastore Connection Driver :    com.mysql.jdbc.Driver
Metastore connection User:       hive
Starting metastore schema initialization to 2.0.0
Initialization script hive-schema-2.0.0.mysql.sql
Initialization script completed
schemaTool completed

脚本hive-schema-2.0.0.mysql.sql会在配置的Hive元数据库中初始化创建表。

 

成功启动并进入Hive2.0之后,建了一张外部表lxw1234_text,在执行”SELECT COUNT(1) FROM lxw1234_text”时候,出现了以下错误:

3. Kryo序列化和反序列化的问题

2016-03-31 09:11:20,902 ERROR [main] org.apache.hadoop.hive.ql.exec.Utilities: 
Failed to load plan: hdfs://cdh5/tmp/hive/lxwen/15acb968-5c66-449e-8d70-803093bbda9e/hive_2016-03-31_09-11-02_675_3017724850988129962-1/-mr-10005/81b953d0-d50d-487f-8273-4591ad7aaef9/map.xml
Caused by: org.apache.hive.com.esotericsoftware.kryo.KryoException: Encountered unregistered class ID: 21
Serialization trace:
outputFileFormatClass (org.apache.hadoop.hive.ql.plan.PartitionDesc)
aliasToPartnInfo (org.apache.hadoop.hive.ql.plan.MapWork)

在NodeManager执行任务时候,反序列化任务执行计划时候报错。

最后排查发现是因为NodeManager上CLASSPATH中加载了其他版本(0.13)Hive的jar包导致的这个错误。
修改NadeManager上的CLASSPATH配置,把Hive相关的配置删除,重启所有NodeManager,再次执行,问题解决。


您可以关注 lxw的大数据田地 ,或者 加入邮件列表 ,随时接收博客更新的通知邮件。

 

 

如果觉得本博客对您有帮助,请 赞助作者

转载请注明:lxw的大数据田地 » 记录一下Hive2.0安装配置遇到的问题

喜欢 (8)
分享 (0)
发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址