Hadoop
環(huán)境介紹
?Hadoop安裝路徑
?/home/test/Desktop/hadoop-1.0.0/
?Hadoop 元數(shù)據(jù)存放目錄
?/home/test/data/core/namenode
?Hadoop 數(shù)據(jù)存放路徑
?/home/test/data/core/datanode
Hive
環(huán)境規(guī)劃
?Hive安裝路徑
?/home/test/Desktop/
?Hive數(shù)據(jù)存放路徑
?hdfs
?/user/hive/warehouse
?Hive元數(shù)據(jù)
?第三方數(shù)據(jù)庫(kù)
?derby mysql
軟件準(zhǔn)備
?OS
?ubuntu
?JDK
?java 1.6.0_27
?Hadoop
?hadoop-1.0.0.tar
?Hive
?hive-0.8.1.tar
Hive
配置文件介紹
?hive-site.xml hive的配置文件
?hive-env.sh hive的運(yùn)行環(huán)境文件
?hive-default.xml.template 默認(rèn)模板
?hive-env.sh.template hive-env.sh默認(rèn)配置
?hive-exec-log4j.properties.template exec默認(rèn)配置
?hive-log4j.properties.template log默認(rèn)配置
hive
-site.xml
<
property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost:3306/hive?createData
baseIfNotExist=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>root</value>
<description>username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>test</value>
<description>password to use against metastore database</description>
</property>
hive
-env.sh
?配置Hive的配置文件路徑
?export HIVE_CONF_DIR= your path
?配置Hadoop的安裝路徑
?HADOOP_HOME=your hadoop home
第三部分:使用Derby數(shù)據(jù)庫(kù)的安裝方式
什么是
Derby
安裝方式
?Apache Derby是一個(gè)完全用java編寫(xiě)的數(shù)據(jù)庫(kù),所以可以跨平臺(tái),但需要在JVM中運(yùn)行
?Derby是一個(gè)Open source的產(chǎn)品,基于Apache License 2.0分發(fā)
?即將元數(shù)據(jù)存儲(chǔ)在Derby數(shù)據(jù)庫(kù)中,也是Hive默認(rèn)的安裝方式
安裝
Hive
?解壓Hive
?tarzxvf hive-0.8.1.tar /home/test/Desktop
?建立軟連接
?ln –s hive-0.8.1 hive
?添加環(huán)境變量
?export HIVE_HOME=/home/test/Desktop/hive
?export PATH=….HIVE_HOME/bin:$PATH:.
配置
Hive
?進(jìn)入hive/conf目錄
?依據(jù)hive-env.sh.template,創(chuàng)建hive-env.sh文件
?cp hive-env.sh.template hive-env.sh
?修改hive-env.sh
?指定hive配置文件的路徑
?export HIVE_CONF_DIR=/home/test/Desktop/hive/conf
?指定Hadoop路徑
?HADOOP_HOME=/home/test/Desktop/hadoop
hive-site.xml
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:derby:;databaseName=metastore_db;create=true</value>
<description>JDBC connect string for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>org.apache.derby.jdbc.EmbeddedDriver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>APP</value>
<description>username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>mine</value>
<description>password to use against metastore database</description>
</property>
啟動(dòng)
Hive
?命令行鍵入
?Hive
?顯示
WARNING: org.apache.hadoop.metrics.jvm.EventCounter is deprecated. Please use org.apache.hadoop.log.metrics.EventCounter in all the log4j.properties files.
Logging initialized using configuration in jar:file:/home/test/Desktop/hive-0.8.1/lib/hive-common-0.8.1.jar!/hive-log4j.properties
Hive history file=/tmp/test/hive_job_log_test_201208260529_167273830.txt
hive>
測(cè)試語(yǔ)句
?建立測(cè)試表test
?create table test (key string);
?show tables;
第四部分:使用MySQL數(shù)據(jù)庫(kù)的安裝方式
安裝
MySQL
?Ubuntu 采用apt-get安裝
?sudo apt-get install mysql-server
?建立數(shù)據(jù)庫(kù)hive
?createdatabasehive
?創(chuàng)建hive用戶(hù),并授權(quán)
?grantallonhive.*tohive@'%'identifiedby'hive';
?flushprivileges;
安裝
Hive
?解壓Hive
?tarzxvf hive-0.8.1.tar /home/test/Desktop
?建立軟連接
?ln –s hive-0.8.1 hive
?添加環(huán)境變量
?export HIVE_HOME=/home/test/Desktop/hive
?export PATH=….HIVE_HOME/bin:$PATH:.
修改
hive-site.xml
<property>
<name>
javax.jdo.option.ConnectionURL
</name>
<value>
jdbc:mysql://localhost:3306/hive
</value>
</property>
<property>
<name>
javax.jdo.option.ConnectionDriverName
</name>
<value>
com.mysql.jdbc.Driver
</value>
</property>
<property>
<name>
javax.jdo.option.ConnectionPassword
</name>
<value>
hive
</value>
</property>
<property>
<name>
hive.hwi.listen.port
</name>
<value>
9999
</value>
<description>
ThisistheporttheHiveWebInterfacewilllistenon
</description>
</property>
<property>
<name>
datanucleus.autoCreateSchema
</name>
<value>
false
</value>
</property>
<property>
<name>
datanucleus.fixedDatastore
</name>
<value>
true
</value>
</property>
<property>
<name>
hive.metastore.local
</name>
<value>
true
</value>
<description>
controlswhethertoconnecttoremovemetastoreserveroropenanewmetastoreserverinHiveClientJVM
</description>
</property>
啟動(dòng)
Hive
?命令行鍵入
?Hive
?顯示
WARNING: org.apache.hadoop.metrics.jvm.EventCounter is deprecated. Please use org.apache.hadoop.log.metrics.EventCounter in all the log4j.properties files.
Logging initialized using configuration in jar:file:/home/test/Desktop/hive-0.8.1/lib/hive-common-0.8.1.jar!/hive-log4j.properties
Hive history file=/tmp/test/hive_job_log_test_201208260529_167273830.txt
hive>
測(cè)試語(yǔ)句
?建立測(cè)試表test
?create table test (key string);
?show tables;
轉(zhuǎn)載:
http://jenmhdn.iteye.com/blog/1709621
更多文章、技術(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ì)您有幫助就好】元
