今天主要進行了Hive的安裝與配置
學習視訊:尚矽谷大資料教程
在這裡記錄一下安裝過程中遇到的一些錯誤,主要問題集中在 hive-site.xml 檔案中
1、Hive啟動報錯
com.ctc.wstx.exc.WstxParsingException: Illegal character entity: expansion character
經過查詢發現在 hive-site.xml 的 第3215行 (具體行數看錯誤資訊),字元中包含特殊字元(????)
<property>
<name>hive.txn.xlock.iow</name>
<value>true</value>
<!--
<description>
Ensures commands with OVERWRITE (such as INSERT OVERWRITE) acquire Exclusive locks fortransactional tables. This ensures that inserts (w/o overwrite) running concurrently
are not hidden by the INSERT OVERWRITE.
</description>
-->
</property>
解決辦法:把這個 <description></description>注釋掉
2、找不到 hive-site.xml
按照視訊教學在啟動Hive,以及檢視資料庫,資料表資訊時出現 “找不到 hive-site.xml檔案 ”錯誤
視訊的順序略有問題,這裡我采用了另一篇博文的建議:hive 0.12 安裝配置
(1)進入hive下的conf目錄,将 hive-env.sh.template、hive-exec-log4j.properties.template、hive-log4j.properties.template重命名,去掉".template"
(2)将hive-default.xml.template重命名為hive-site.xml
(3)(hive-env.sh.template檔案中存在一個bug,第2000行,<value>auth</auth>,應該改成<value>auth</value>,否則啟動時會報錯
這個錯誤我沒有找到,因為我的這個檔案裡根本就沒有2000行.....
3、Hive啟動報錯
java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D
結合網絡建議,我采取了以下兩種方案(不知道具體哪個好使,有同樣問題的就都改吧)
3.1 将 hive-site.xml 配置檔案中
${system:java.io.tmpdir}
這類配置值中的
system:
直接去掉,改為
${java.io.tmpdir}
,讓 Java 程式直接讀
${java.io.tmpdir}
即可。
例如:
<property>
<name>hive.server2.logging.operation.log.location</name>
<value>${system:java.io.tmpdir}/${system:user.name}/operation_logs</value>
<description>Top level directory where operation logs are stored if logging functionality is enabled</description>
</property>
改為:
<property>
<name>hive.server2.logging.operation.log.location</name>
<value>${java.io.tmpdir}/${user.name}/operation_logs</value>
<description>Top level directory where operation logs are stored if logging functionality is enabled</description>
</property>
3.2 修改如下屬性
<property>
<name>hive.exec.scratchdir</name>
<value>/tmp/hive</value>
<description>HDFS root scratch dir for Hive jobs which gets created with write all (733) permission. For each connecting user, an HDFS scratch dir: ${hive.exec.scratchdir}/<username> is created, with ${hive.scratch.dir.permission}.</description>
</property>
<property>
<name>hive.exec.local.scratchdir</name>
<value>/tmp/hive/local</value>
<description>Local scratch space for Hive jobs</description>
</property>
<property>
<name>hive.downloaded.resources.dir</name>
<value>/tmp/hive/resources</value>
<description>Temporary local directory for added resources in the remote file system.</description>
</property>
注意:由于借鑒了博文,是以在後續視訊學習的過程中有些步驟有些許改動;