天天看点

启动hive命令报错 “Metastore contains multiple versions”错误日志: 解决方案: 出现这类异常问题原因

错误日志:

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:)
      at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:)
      at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:)
      at java.lang.reflect.Method.invoke(Method.java:)
      at org.apache.hadoop.util.RunJar.run(RunJar.java:)
     at org.apache.hadoop.util.RunJar.main(RunJar.java:)
 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:)
     at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.<init>(RetryingMetaStoreClient.java:)
     at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:)
     at org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:)
     at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:)
     at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:)
     ...  more
 Caused by: java.lang.reflect.InvocationTargetException
     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:)
     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:)
     at java.lang.reflect.Constructor.newInstance(Constructor.java:)
     at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:)
     ...  more
 Caused by: MetaException(message:Metastore contains multiple versions)
     at org.apache.hadoop.hive.metastore.ObjectStore.getMSchemaVersion(ObjectStore.java:)
     at org.apache.hadoop.hive.metastore.ObjectStore.getMetaStoreSchemaVersion(ObjectStore.java:)
     at org.apache.hadoop.hive.metastore.ObjectStore.checkSchema(ObjectStore.java:)
     at org.apache.hadoop.hive.metastore.ObjectStore.verifySchema(ObjectStore.java:)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:)
     at java.lang.reflect.Method.invoke(Method.java:)
     at org.apache.hadoop.hive.metastore.RawStoreProxy.invoke(RawStoreProxy.java:)
     at com.sun.proxy.$Proxy5.verifySchema(Unknown Source)
     at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.getMS(HiveMetaStore.java:)
     at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.createDefaultDB(HiveMetaStore.java:)
     at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.init(HiveMetaStore.java:)
     at org.apache.hadoop.hive.metastore.RetryingHMSHandler.<init>(RetryingHMSHandler.java:)
     at org.apache.hadoop.hive.metastore.RetryingHMSHandler.getProxy(RetryingHMSHandler.java:)
     at org.apache.hadoop.hive.metastore.HiveMetaStore.newRetryingHMSHandler(HiveMetaStore.java:)
     at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:)
     at org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.<init>(SessionHiveMetaStoreClient.java:)
     ...  more
           
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45

解决方案:

因为hive metastore存储在mysql中,所以登录mysql,use hive所使用的DB,然后 查询下VERSION表 

mysql> select * from VERSION;

+——–+—————-+——————+ 

| VER_ID | SCHEMA_VERSION | VERSION_COMMENT | 

+——–+—————-+——————+ 

| 1 | 0.14.0 | Set by MetaStore | 

| 2 | 0.14.0 | Set by MetaStore | 

| 3 | 0.14.0 | Set by MetaStore | 

| 4 | 0.14.0 | Set by MetaStore | 

| 5 | 0.14.0 | Set by MetaStore | 

| 6 | 0.14.0 | Set by MetaStore | 

+——–+—————-+——————+

保留第一条记录,其他记录全部删除

  • 1

出现这类异常问题原因

hive 是不支持并发的,估计我同事 不小心启动多个hive,也可能是网络问题,反正很诡异