Hive 三种运行方式之 本地 derby

这种方式是最简单的存储方式,只需要在hive-site.xml做如下配置便可

 
   
<configuration>  

<property>  
  <name>javax.jdo.option.ConnectionURLname>  
  <value>jdbc:derby:;databaseName=metastore_db;create=truevalue>  
property>  

<property>  
  <name>javax.jdo.option.ConnectionDriverNamename>  
  <value>org.apache.derby.jdbc.EmbeddedDrivervalue>  
property>  

<property>  
  <name>hive.metastore.localname>  
  <value>truevalue>  
property>  

<property>  
  <name>hive.metastore.warehouse.dirname>  
  <value>/user/hive/warehousevalue>  
property>  

configuration>  

注:使用derby存储方式时,运行hive会在当前目录生成一个derby文件和一个metastore_db目录。这种存储方式的弊端是在同一个目录下同时只能有一个hive客户端能使用数据库,否则会提示如下错误

[html] view plaincopyprint?
hive> show tables;  
FAILED: Error in metadata: javax.jdo.JDOFatalDataStoreException: Failed to start database 'metastore_db', see the next exception for details.  
NestedThrowables:  
java.sql.SQLException: Failed to start database 'metastore_db', see the next exception for details.  
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask  
hive> show tables;
FAILED: Error in metadata: javax.jdo.JDOFatalDataStoreException: Failed to start database 'metastore_db', see the next exception for details.
NestedThrowables:
java.sql.SQLException: Failed to start database 'metastore_db', see the next exception for details.
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask

你可能感兴趣的:(hive,derby,derby,hive)