1、安裝hadoop集群並啟動
2、安裝mysql資料庫
3、hive安裝
1)、上傳安裝包至/usr/local目錄中
2)、解壓:
tar -zxvf apache-hive-1.2.1-bin.tar.gz
3)、將mysql的jar包匯入解壓後的apache-hive中的lib檔案下
4)、啟動hive
/usr/local/apache-hive-1.2.1-bin/bin/hive
4、hive基本操作
建立資料看庫
hive> create database bighive;
oktime taken: 2.105 seconds
檢視資料庫
hive> show databases;
okbighive
default
time taken: 0.165 seconds, fetched: 2 row(s)
建立表#預設分隔符的建表語句
hive> create table hive_stu(id int,name string,age int,*** string);
oktime taken: 0.87 seconds
#指定分隔符為','的建表語句
hive> create table hive_stu(id int,name string,age int,*** string)row format delimited fields terminated by ',';
oktime taken: 0.87 seconds
檢視表hive> show tables;
okhive_stu
time taken: 0.161 seconds, fetched: 1 row(s)
5、通過hadoop服務鏈結檢視hive產生資料
6、製作測試資料
hive預設以八進位制編碼\001作為分割符,使用vi編輯工具進入insert模式
ctrl + v 可以輸入 ^符號
ctrl + a 可以輸入a---'\001'
1^aliuyifei^a20^afemal
2^ahujun^a25^amale
3^axuxubaobao^a30^afemale
將資料上傳至hadoop中hive生成的資料夾下
hadoop fs put ./hive.info /user/hive/warehouse/hive_stu
7、檢視資料
hive> select * from hive_stu;
ok1 liuyifei 20 femal
2 hujun 25 male
3 xuxubaobao 30 female
time taken: 0.445 seconds, fetched: 3 row(s)
hive jso匹配 Hive資料倉儲歷史拉鍊實現
背景 發現最近寫部落格的頻率越來越低了,是太忙了?或者是不想寫?呵呵!革命尚未成功,同志還需努力。今天利用下午一點空餘時間整理如何基於hive上實現資料倉儲中的歷史拉鍊演算法。筆者使用hive1.1進行測試。歷史儲存方式 下面先來了解一下歷史資料儲存的幾種方法。資料歷史的儲存方式 1 切片儲存 通過...
Hive安裝手冊
一 安裝準備 2 jdk版本 jdk 6u20 linux i586.bin 3 作業系統 linux s132 2.6.9 78.8axs2smp 1 smp tue dec 16 02 42 55 est 2008 x86 64 x86 64 x86 64 gnu linux 4 預設前提是安裝...
hive安裝筆記
安裝教程網頁 安裝mysql 1 建立資料庫和使用者 create database hive grant all on hive.to hive identified by hive grant all on hive.to hive localhost identified by hive 2 ...