我把hive-0.12升級成0.13.1版本,先在mysql裡執行了source upgrade-0.12.0-to-0.13.0.mysql.sql成功了,然後在mysql中創建了一個hivenew(0.12版的是hive)用戶,並給予了權限,更改了hive-site.xml文件如下:
1. <property>
2. <name>hive.stats.dbclass</name>
3. <value>jdbc:mysql</value>
4. <description>The default database that stores temporary hive statistics.</description>
5. </property>
6.
7. <property>
8. <name>hive.stats.jdbcdriver</name>
9. <value>com.mysql.jdbc.Driver</value>
10. <description>The JDBC driver for the database that stores temporary hive statistics.</description>
11. </property>
12.
13. <property>
14. <name>hive.stats.dbconnectionstring</name>
15. <value>jdbc:mysql://localhost:3306/hivenew</value>
16. <description>The default connection string for the database that stores temporary hive statistics.</description>
17. </property>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost:3306/hivenew?createDatabaseIfNotExist=true</value>
<description>JDBC connect string for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hivenew</value>
<description>username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>hivenew</value>
<description>password to use against metastore database</description>
</property>
保存後,把mysql的jdbc復制到了lib下,然後啟動hive,雖然能正常顯示hive>,和show tables;
但是在mysql裡根本沒有hivenew這個數據庫,我裝0.12時裝好後自動就有了hive數據庫,而show tables,也沒有我在hivenew下創建的表格,而且經常出現Caused by: ERROR XSDB6: Another instance of Derby may have already booted the database /opt/apache-hive-0.13.1-bin/metastore_db.這樣的錯誤
可見元數據庫仍舊是derby,更詭異的是我把hive-site.xml刪掉之後,hive它仍舊工作良好能正常顯示hive>,和show tables,難道hive-site.xml的配置都無關緊要嗎?求求大家幫幫我,急死人了
很明顯的是hive-site.xml文件沒生效,即使刪除了該文件,默認也使用的是derby數據庫。針對這種情況,樓主可以重新創建hive-site.xml文件,然後修改為mysql,再重啟hive