Dowemo

Reference: http://mars914. Iteye. com/blog/1410035.


Hive-site. Xml modify the following configuration.

复制代码

<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>





复制代码

Error:


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


Output detailed error messages with the following command

复制代码

$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. )
复制代码


At this time the MySQL is logged in, the hivedb database for the hive site. Xml configuration has been created, indicating that the MySQL link is normal.

Reference: http://www. Micmiu. com/bigdata/hive/hive-default-setup/.

Modify the hive site. Xml for the following configuration:

复制代码

<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>





复制代码


Run again:


hive> show tables;


OK


Time taken: 7.651 seconds


hive> 





Continue the hive command.


>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

Workaround: ( reference: http://conkeyn. Iteye. com/blog/2010818, http://blog. Csdn. net/slx_2011/article/details/24770217 ).

Hive isn't consistent with the version of libthrift x. X. X. Jar in lib and hadoop directories, copying the hive lib libthrift 0. 9. 0. Jar to the hadoop lib directory, delete the original libthrift-0. 8. 0. Jar.

备注:

Hadoop version: hadoop-1. 1. 2.

Hive version: hive-0. 12. 0.

Hbase version: hbase-0. 94. 20.




Copyright © 2011 Dowemo All rights reserved.    Creative Commons   AboutUs