hive 错误 InvalidObjectException(message:Role admin already exists.)
InvalidObjectException(message:Role admin already exists.) at org.apache.hadoop.hive.metastore.ObjectStore.addRole(ObjectStore.java:3020) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.hadoop.hive.metastore.RawStoreProxy.invoke(RawStoreProxy.java:108) at com.sun.proxy.$Proxy9.addRole(Unknown Source) at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.createDefaultRoles(HiveMetaStore.java:544) at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.init(HiveMetaStore.java:398) at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.<init>(HiveMetaStore.java:356) InvalidObjectException(message:Role public already exists.) at org.apache.hadoop.hive.metastore.ObjectStore.addRole(ObjectStore.java:3020) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.hadoop.hive.metastore.RawStoreProxy.invoke(RawStoreProxy.java:108) at com.sun.proxy.$Proxy9.addRole(Unknown Source) at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.createDefaultRoles(HiveMetaStore.java:553) InvalidObjectException(message:All is already granted by admin) at org.apache.hadoop.hive.metastore.ObjectStore.grantPrivileges(ObjectStore.java:3713) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.hadoop.hive.metastore.RawStoreProxy.invoke(RawStoreProxy.java:108) at com.sun.proxy.$Proxy9.grantPrivileges(Unknown Source) at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.createDefaultRoles(HiveMetaStore.java:567)
由于最近使用大数据的hive,生产环境较为稳定,我私下搭了一个环境,出现了问题,就是上面的异常,这个异常我在网上查了好久,数据库删了几次,hdfs删了几次,还是无法解决,一启动hive就报上面的错误(这个错误会导致无法删除数据库,一些莫名其妙的错误),我研究了2个多小时,终于找到了问题所在,现在说说下面该处理这个问题
现在先说说hive的配置
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://m1-4:3306/hive?createDatabaseIfNotExist=true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
createDatabaseIfNotExist=true这句话的意思显而易见如果不存在创建数据库
这个就方便了一个事,就是在mysql的数据库里面不用写createdatabasehive;
但是它的管理权限就混乱,跟线上的权限表GLOBAL_PRIVS虽然一致,但是启动就会报上面的异常
后来我删掉了hive数据库,手动建立了createdatabasehive;
然后为了避免错误又做了一次数据转码alterdatabasehivecharactersetlatin1;
这次再连接hive没出现错误,能正常删除hive内部的表