hive配置mysql后,hive启动失败主要是Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaSt

问题一:
java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient

[hadoop@master hive1.0.0]$ bin/hive
 
Logging initialized using configuration in file:/opt/modules/hive1.0.0/conf/hive-log4j.properties
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/modules/hadoop-2.6.0/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/modules/hive1.0.0/lib/hive-jdbc-1.0.0-standalone.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
	at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:444)
	at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:626)
	at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:570)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
	at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
	at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1453)
	at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.<init>(RetryingMetaStoreClient.java:63)
	at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:73)
	at org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:2664)
	at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:2683)
	at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:425)
	... 8 more
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
	at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1451)
	... 13 more
Caused by: javax.jdo.JDOFatalDataStoreException: Unable to open a test connection to the given database. JDBC url = jdbc:mysql://master:3306/hive?characterEncoding=UTF-8, username = hive. Terminating connection pool (set lazyInit to true if you expect to start your database after your app). Original Exception: ------
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

问题二:
Could not create ServerSocket on address 0.0.0.0/0.0.0.0:9083
主要是问题一,解决了好久,还好解决成功了!贼熟了
1 首先检查hive-site.xml看是否配置错误。
我先试着用Navicat连接了一下mysql的地址,判断是否可以连接上,然后查了很多资料又重新写了一下它,就添了 一些选项。然后又检查了一下环境配置hive的配置文件hive-env.sh,确定这里面有这两个项

HADOOP_HOME=/opt/modules/cdh/hadoop-2.5.0-cdh5.3.6
export HIVE_CONF_DIR=/opt/modules/cdh/hive-0.13.1-cdh5.3.6/conf

问题三
MetaException(message:Metastore contains multiple versions (2)
2 添加hive的环境变量到、etc/profile中,开机就会扫描它。
export HIVE_HOME=/home/ssl/app/hive
export PATH=:$HIVE_HOME/bin
然后重新启动,一般就可以了。主要是这两个配置文件的原因。
但是我这里启动失败
但是报的错误不一样了
Could not create ServerSocket on address 0.0.0.0/0.0.0.0:9083
这时jps发现有几个runjar
so kill -9 杀掉占用端口号即可。
再重试一下,再bin/hive就可以了
然后我就开心的写了一个博客,回头看又不行了,莫名的报了的错误,我就退出了,然后我又开启了一下就又报问题一的错,然后我就又关机重启折腾了好久,它就报问题三了,然后才知道有两个版本sql,删除一个就可以了,重新启动就好了。
mysql> select * from VERSION;
delete from VERSION where VER_ID=1;

你可能感兴趣的:(hive)