Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. java.lang.RuntimeExcept

参考:http://mars914.iteye.com/blog/1410035


hive-site.xml 修改如下配置

复制代码
<property>
  <name>javax.jdo.option.ConnectionURL</name>
  <value>jdbc:mysql://localhost:3306/hivedb?createDatabaseIfNotExist=true</value>
    <!--jdbc:mysql://localhost:3306/hivedb(hivedb为在mysql中要创建的hive名称)?-->
  <description>JDBC connect string for a JDBC metastore</description>
</property>

<property>
  <name>javax.jdo.option.ConnectionDriverName</name>
  <value>com.mysql.jdbc.Driver</value>
  <!--mysql-connector-java-5.1.10-bin.jar 的版本,不需要和mysql的版本一致-->
  <description>Driver class name for a JDBC metastore</description>
</property>

<property>
  <name>javax.jdo.option.ConnectionUserName</name>
  <value>root<!--链接mysql的用户名--></value>
  <description>username to use against metastore database</description>
</property>


<property>
  <name>javax.jdo.option.ConnectionPassword</name>
  <value>root<!--链接mysql的密码--></value>
  <description>password to use against metastore database</description>
</property>
复制代码

 报错:

hive> show tables;
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. 
java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient


用如下命令输出详细错误信息

复制代码
$hive -hiveconf hive.root.logger=DEBUG,console

14/11/25 17:18:47 ERROR exec.DDLTask: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: 
Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient ... Caused by: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient ... Caused by: java.lang.reflect.InvocationTargetException ... Caused by: MetaException(message:Version information not found
in metastore. )
复制代码


此时登录mysql,在hive-site.xml配置的hivedb数据库已经创建,说明mysql链接正常

参考:http://www.micmiu.com/bigdata/hive/hive-default-setup/

修改hive-site.xml,进行如下配置:

复制代码
<property>
  <name>hive.metastore.schema.verification</name>
  <value>false</value>
   <description>
   Enforce metastore schema version consistency.
   True: Verify that version information stored in metastore matches with one from Hive jars.  Also disable automatic
         schema migration attempt. Users are required to manully migrate schema after Hive upgrade which ensures
         proper metastore schema migration. (Default)
   False: Warn if the version information stored in metastore doesn't match with one from in Hive jars.
   </description>
</property>
复制代码


再次运行:

hive> show tables;
OK
Time taken: 7.651 seconds
hive> 

继续执行hive命令

>hive create table tb( id int, name string); 
14/11/25 18:22:18 ERROR exec.DDLTask: java.lang.NoSuchMethodError: org.apache.thrift.EncodingUtils.setBit(BIZ)B

解决办法:(参考:http://conkeyn.iteye.com/blog/2010818, http://blog.csdn.net/slx_2011/article/details/24770217)

hive和hadoop目录下lib中libthrift-x.x.x.jar 版本不一致导致的,将hive/lib/libthrift-0.9.0.jar 拷贝到 hadoop/lib/目录下,删除原 libthrift-0.8.0.jar

 

PS:

hadoop版本:hadoop-1.1.2

hive版本:hive-0.12.0

hbase版本:hbase-0.94.20

猜你喜欢

转载自blog.csdn.net/qq_35240673/article/details/77744779