运行hive命令后,无法创建数据库
遵循Apache网站上的官方“Getting Started”指南
NestedThrowables:
java.sql.SQLException: Unable to open a test connection to the given
database. JDBC url = jdbc:derby:;databaseName=metastore_db;create=true,
username = APP. Terminating connection pool (set lazyInit to true if you
expect to start your database after your app). Original Exception: ------
java.sql.SQLException: Failed to create database 'metastore_db', see the next exception for details.
Caused by: java.sql.SQLException: Directory /opt/hive/bin/metastore_db cannot be created.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
... 80 more
Caused by: ERROR XBM0H: Directory /opt/hive/bin/metastore_db cannot be created.
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at org.apache.derby.impl.services.monitor.StorageFactoryService$10.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.derby.impl.services.monitor.StorageFactoryService.createServiceRoot(Unknown Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.bootService(Unknown Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.createPersistentService(Unknown Source)
at org.apache.derby.iapi.services.monitor.Monitor.createPersistentService(Unknown Source)
... 80 more
答案 0 :(得分:0)
检查特定用户是否有权创建/opt/hive/bin/metastore_db
如果没有,则添加权限
sudo chmod -R 777 /opt/hive/bin/metastore_db
希望这会有所帮助
答案 1 :(得分:0)
使用: chown -R hduser:hduser * xxxxxxxxx / hive / (*或您使用的任何用户名/ usergroup)授予所有者(因此具有完全权限。..包括写入/创建)
(我不知道是否有一个名为hive:hive的默认配置单元用户/组,我创建了该配置单元,但授予了该配置单元用户的所有权,将无法正常工作。)
基本上,安装说明假定您(继承您权利的hadoop和因此产生的配置单元)具有足够的权限。
(注意:即使您已经是管理员,这也相当于在Windows的“管理模式”下运行命令提示符)。 Linux在许多方面趋于灵活,因此会造成混乱。
答案 2 :(得分:0)
我刚刚在hive:hive-site.xml中以及在创建/ user / hive / warehouse的安装步骤中意识到:
“ 用户”可以很容易地与“ usr ”混淆,根本没有任何警报。所以请记住:
在hadoop fs下,这是/ user / hive / warehouse,它指向meta__db文件夹,用于创建(不是/ usr / hive / warehouse)