文檔及下周網(wǎng)址
- 官網(wǎng)
http://hive.apache.org - 文檔
https://cwiki.apache.org/confluence/display/Hive/GettingStarted https://cwiki.apache.org/confluence/display/Hive/Home - 下載
http://archive.apache.org/dist/hive/
必要條件Requirements
- Java 1.7
Note: Hive versions 1.2 onward require Java 1.7 or newer. Hive versions 0.14 to 1.1 work with Java 1.6 as well. Users are strongly advised to start moving to Java 1.8 (see HIVE-8607). - Hadoop 2.x (preferred推薦), 1.x (not supported by Hive 2.0.0 onward).
Hive versions up to 0.13 also supported Hadoop 0.20.x, 0.23.x. - Hive is commonly used in production(生產(chǎn)環(huán)境) Linux and Windows environment. Mac is a commonly used development environment. The instructions in this document are applicable to Linux and Mac. Using it on Windows would require slightly different steps.
上傳hive包和myql包到linux系統(tǒng)
啟動(dòng)hdfs和yarn服務(wù)及MapReduce歷史
- sbin/start-dfs.sh
- sbin/start-yarn.sh
-
sbin/mr-jobhistory-damon.sh start historyserver
解壓及修改配置文件
hive依賴于hadoop
tar -zxf apache-hive-0.13.1-bin.tar.gz -C /opt/modules/
-C 表示change的意思把a(bǔ)pache-hive-0.13.1-bin 重新命名為hive-0.13.1
mv apache-hive-0.13.1-bin hive-0.13.1-
把hive-env.sh.template重新命令為hive-env.sh
修改hadoop目錄
修改hive-en.sh 中的 HADOOP_HOME=/opt/modules/hadoop-2.5.0修改hive配置文件目錄
opt/modules/hive-0.13.1/conf
運(yùn)行hive
在hdfs系統(tǒng)中添加目錄
命令:bin/hdfs dfs -mkdir -p /user/hive/warehouse 和/tmp把這兩個(gè)目錄放到一個(gè)組權(quán)限
set them chmod g+w before you can create a table in Hive
命令:bin/hdfs dfs -chmod 777 /tmp
bin/hdfs dfs -chmod g+w /user/hive/warehouse
bin/hdfs dfs -chmod777 /user/hive/warehouse
-
運(yùn)行 bin/hive
第一次運(yùn)行比較慢埂奈,在創(chuàng)建元數(shù)據(jù)庸追,默認(rèn)會(huì)創(chuàng)建一個(gè)default庫(kù)尸昧。庫(kù)為空庫(kù),沒有任何表。
-
創(chuàng)建表并執(zhí)行count查詢
在這個(gè)過程中會(huì)執(zhí)行MapReduce
網(wǎng)頁(yè)訪問地址