当前位置:   article > 正文

记录一下hive启动metestore服务时报错

记录一下hive启动metestore服务时报错

【背景说明】

之前hadoop有问题,把hadoop和MySQL删了重装,hive没有动,然后启hive的metastore服务的时候,显示找不到metastore数据库

【报错】

  1. Caused by: java.lang.reflect.InvocationTargetException
  2. at sun.reflect.GeneratedConstructorAccessor74.newInstance(Unknown Source)
  3. at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  4. at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  5. at org.datanucleus.plugin.NonManagedPluginRegistry.createExecutableExtension(NonManagedPluginRegistry.java:606)
  6. at org.datanucleus.plugin.PluginManager.createExecutableExtension(PluginManager.java:330)
  7. at org.datanucleus.store.AbstractStoreManager.registerConnectionFactory(AbstractStoreManager.java:203)
  8. at org.datanucleus.store.AbstractStoreManager.<init>(AbstractStoreManager.java:162)
  9. at org.datanucleus.store.rdbms.RDBMSStoreManager.<init>(RDBMSStoreManager.java:285)
  10. at sun.reflect.GeneratedConstructorAccessor73.newInstance(Unknown Source)
  11. at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  12. at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  13. at org.datanucleus.plugin.NonManagedPluginRegistry.createExecutableExtension(NonManagedPluginRegistry.java:606)
  14. at org.datanucleus.plugin.PluginManager.createExecutableExtension(PluginManager.java:301)
  15. at org.datanucleus.NucleusContextHelper.createStoreManagerForProperties(NucleusContextHelper.java:133)
  16. at org.datanucleus.PersistenceNucleusContextImpl.initialise(PersistenceNucleusContextImpl.java:422)
  17. at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.freezeConfiguration(JDOPersistenceManagerFactory.java:817)
  18. ... 43 more
  19. Caused by: org.datanucleus.exceptions.NucleusException: Attempt to invoke the "HikariCP" plugin to create a ConnectionPool gave an error : Failed to initialize pool: Unknown database 'metastore'
  20. at org.datanucleus.store.rdbms.ConnectionFactoryImpl.generateDataSources(ConnectionFactoryImpl.java:232)
  21. at org.datanucleus.store.rdbms.ConnectionFactoryImpl.initialiseDataSources(ConnectionFactoryImpl.java:117)
  22. at org.datanucleus.store.rdbms.ConnectionFactoryImpl.<init>(ConnectionFactoryImpl.java:82)
  23. ... 59 more
  24. Caused by: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Unknown database 'metastore'
  25. at com.zaxxer.hikari.pool.HikariPool.throwPoolInitializationException(HikariPool.java:544)
  26. at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:536)
  27. at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:112)
  28. at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:72)
  29. at org.datanucleus.store.rdbms.connectionpool.HikariCPConnectionPoolFactory.createConnectionPool(HikariCPConnectionPoolFactory.java:176)
  30. at org.datanucleus.store.rdbms.ConnectionFactoryImpl.generateDataSources(ConnectionFactoryImpl.java:213)
  31. ... 61 more
  32. Caused by: java.sql.SQLSyntaxErrorException: Unknown database 'metastore'
  33. at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
  34. at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
  35. at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:828)
  36. at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:448)
  37. at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:241)
  38. at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198)
  39. at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:95)
  40. at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:101)
  41. at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:356)
  42. at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:199)
  43. at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:444)
  44. at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:515)

【原因】

我真是个傻子,重装以后要在MySQL初始化metastore元数据库

【解决】

3.3.1初始化元数据库
1)登陆MySQL。
[atguigu@hadoop102 conf]$ mysql -uroot -p000000
2)新建Hive元数据库。
mysql> create database metastore;
3)初始化Hive元数据库。
[atguigu@hadoop102 conf]$ schematool -initSchema -dbType mysql -verbose
4)修改元数据库字符集。
Hive元数据库的字符集默认为Latin1,由于其不支持中文字符,所以建表语句中如果包含中文注释,会出现乱码现象。如需解决乱码问题,须做以下修改。
修改Hive元数据库中存储注释的字段的字符集为utf-8。
(1)字段注释。
mysql> use metastore;
mysql> alter table COLUMNS_V2 modify column COMMENT varchar(256) character set utf8;
(2)表注释。
mysql> alter table TABLE_PARAMS modify column PARAM_VALUE mediumtext character set utf8;
5)退出mysql。
mysql> quit;
3.3.2启动Hive客户端
1)启动Hive客户端。
[atguigu@hadoop102 hive]$ hive
2)查看一下数据库。
hive (default)> show databases;
OK
database_name
default
Time taken: 0.955 seconds, Fetched: 1 row(s)

成功~

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/458243?site
推荐阅读
相关标签
  

闽ICP备14008679号