一、上傳hive 0.11解壓后的文件到linux
??? 1、用的版本是shark站點(diǎn)提供的,可能是針對(duì)shark修改了代碼。
??? 2、追加mysql、oracle兩個(gè)jdbc驅(qū)動(dòng)包到lib目錄下。
二、配置相關(guān)文件
??? 1、.bash_profile文件
export HIVE_HOME=/home/kituser/bigdata/hive-0.11.0-bin
export HIVE_CONF_DIR=$HIVE_HOME/conf
export CLASSPATH=$CLASSPATH:$HIVE_HOME/lib
export PATH=$PATH:$HIVE_HOME/bin
??? 2、hive-site.xml
<property>
?? <name>hive.metastore.local</name>
?? <value>true</value>
?? <description>controls whether to connect to remove metastore server or open a new metastore server in Hive Client JVM</description>
</property><property>
?? <name>javax.jdo.option.ConnectionURL</name>
?? <value>jdbc:mysql://172.16.19.139:3306/hive_11_201402</value>
</property>
?
<property>
?? <name>javax.jdo.option.ConnectionDriverName</name>
?? <value>com.mysql.jdbc.Driver</value>
</property><property>
??? <name>javax.jdo.option.ConnectionUserName</name>
??? <value>root</value>
</property><property>
?? <name>javax.jdo.option.ConnectionPassword</name>
?? <value>root</value>
</property>
三、配置mysql數(shù)據(jù)庫(kù)
??? 創(chuàng)建mysql數(shù)據(jù)庫(kù),字符集選擇“l(fā)atin1”,否則在使用hive過(guò)程中會(huì)報(bào)錯(cuò)。
四、較驗(yàn)hive
??? 1、啟動(dòng)hive:
hive
nohup hive --service hiveserver
??? 2、測(cè)試sql:
show tables;
create table shark_test01(id int, name string);
select * from shark_test01;
exit;
??? 查看hive創(chuàng)建的文件:hadoop fs -ls -R /user/hive
五、錯(cuò)誤及解決
錯(cuò)誤3:
MetaException(message:file:/user/hive/warehouse/xxxx is not a directory or unable to create one)
解決:
CLASSPATH中加入HADOOP_CONF_DIR
?
錯(cuò)誤2:
Error in metadata: MetaException(message:Got exception: org.apache.hadoop.hive.metastore.api.MetaException javax.jdo.JDODataStoreException: An exception was thrown while adding/validating class(es) : Specified key was too long; max key length is 767 bytes
解決:
只要修改MySQL中Hive元數(shù)據(jù)庫(kù)MetaStore的字符集便可。
alter database dbname character set latin1;
?
錯(cuò)誤1:
java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient。
解決:
在CLASSPATH中要有mysql的jdbc驅(qū)動(dòng)。
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號(hào)聯(lián)系: 360901061
您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對(duì)您有幫助就好】元
