[持续更新]hive异常解决方案

2,668 阅读1分钟

[持续更新]hive异常解决方案

1. hive日志信息查看

文件路径

  • /tmp/<user.name>/hive.log
  • 默认user.name为root

2. 加载数据失败

报错提示

Loading data to table default.test01
Failed with exception Unable to move source file:/root/hive_test.txt to destination hdfs://bigdata01:9000/user/hive/warehouse/test01/hive_test_copy_1.txt
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask

异常原因

  • datanode没有正常启动

解决方案

  • 重启Hadoop集群

3. 加载驱动失败

报错提示

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.
	at org.datanucleus.store.rdbms.connectionpool.AbstractConnectionPoolFactory.loadDriver(AbstractConnectionPoolFactory.java:58)
	at org.datanucleus.store.rdbms.connectionpool.BoneCPConnectionPoolFactory.createConnectionPool(BoneCPConnectionPoolFactory.java:54)
	at org.datanucleus.store.rdbms.ConnectionFactoryImpl.generateDataSources(ConnectionFactoryImpl.java:213)

异常原因

  • 缺少MySQL驱动包

解决方案

  • 上传mysql驱动包到hive的lib目录下

4. Hive建表报错

报错提示

FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:An exception was thrown while adding/validating class(es) : Column length too big for column 'TYPE_NAME' (max = 21845); use BLOB or TEXT instead
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Column length too big for column 'TYPE_NAME' (max = 21845); use BLOB or TEXT instead

异常原因

  • MySQL编码格式问题

解决方案

  • 登录MySQL执行:
    • use Hive数据库名
    • 查看当前编码:
    • show variables like "char%";
    • 修改编码:
    • alter database Hive数据库名 character set latin1;