-
數據模型:星形模型,雪花模型
查看全部 -
OLTP:連接事務處理,如銀行轉賬,必須扣錢和加錢必須同時失敗或成功。
OLAP:連接分析處理,基于歷史數據,如商品推薦系統,不會對里邊的數據做插入刪除更新的操作。
查看全部 -
數據倉庫只負責查詢,且數據不隨時間而變化
查看全部 -
創建內部表
查看全部 -
時間類型。
查看全部 -
復雜數據類型
查看全部 -
基本數據類型
查看全部 -
web界面
查看全部 -
靜默模式? hive -S? 不產生mapreduce的調試信息,直接輸出最后的結果
查看全部 -
hive 查詢單個字段會轉化成mapreduce任務,但是執行select × from table不會轉換成mapreduce任務
查看全部 -
CLI命令
查看全部 -
常用的CLI命令
進入ClI:輸入hive
查看全部 -
嵌入模式? 元數據存放在derby
本地模式 元數據存放在本地mysql
遠程模式 元數據存放在遠程mysql
查看全部 -
Hive的體系結構
查看全部 -
Hive的體系結構
查看全部 -
HQL的解析和執行過程
查看全部 -
Hive的元數據
查看全部 -
數據的主題。概念查看全部
-
hive桶表(Bucket Table)
--桶表是對數據進行哈希取值,然后放到不同文件中存儲
create?table?bucket_table (sid?int,sanme?string,?age?int) clustered?by?(sname)?into?5?buckets;--根據sname字段進行 哈希運算后放入5個桶中
查看全部 -
hive的外部表(External Table)
create?external?table?external_student (sid?int,sname?string,age?int) row?format?delimited?fields?terminated?by?',' location?'/input';
查看全部 -
hive分區表
create?table?partition_table (sid?int,sname?string) partitioned?by?(gender?string)--分區字段為gender row?format?delimited?fields?terminated?by?',';--字段分割符為逗號 --插入數據 insert?into?table?partition_table?partition(gender="M")? select?sid,sname?from?sample_date?where?gender='M'; insert?into?table?partition_table?partition(gender="F")? select?sid,sname?from?sample_date?where?gender='F'; --查詢計劃 hive>?explain?select?*?from?sample_date?where?gender='M';
查看全部 -
hive創建內部表
create table t1
(tid int, tname string,age int)
location '/mytable/hive/t1'? --location指定表存放路徑
row format delimited fields terminated by ',' ;--列直接的分隔符逗號
create table t2
row format delimited fields terminated by ',' ;--列直接的分隔符逗號
as?
select * from sample_data;
查看全部 -
hive遠程服務啟動
通過遠程連接hive時hive的遠程服務必須啟動
端口:10000
啟動方式:#hive --service hiveserver &
查看全部 -
hive web界面方式
端口 9999
啟動方式:#hive --service hwi &
通過瀏覽器訪問:http://ip地址:9999/hwi/
/conf/hive-site.xml文件中添加如下配置
? ? <property>
? ? ? ? <name>hive.hwi.listen.host</name>
? ? ? ? <value>0.0.0.0</value>
? ? ? ? <description>This is the host address the Hive Web Interface will listen on</description>
? ? </property>
? ? ?
? ? <property>
? ? ? ? <name>hive.hwi.listen.port</name>
? ? ? ? <value>9999</value>
? ? ? ? <description>This is the port the Hive Web Interface will listen on</description>
? ? </property>
? ? ?
? ? <property>
? ? ? ? <name>hive.hwi.war.file</name>
? ? ? ? <value>${HIVE_HOME}/lib/hive-hwi-<version>.war</value>
? ? ? ? <description>This is the WAR file with the jsp content for Hive Web Interface</description>
? ? </property>
參考鏈接地址:
https://cwiki.apache.org/confluence/display/Hive/HiveWebInterface
查看全部 -
hive常用cli命令
查看數據倉庫中的表
show tables;
查看數據倉庫中內置的函數
show functions;
清屏命令
!clear;
查看表結構
desc 表名
查看hdfs上的文件
dfs -ls 目錄
dfs -lsr /user 遞歸模式下顯示/user目錄及子目錄
執行操作系統的命令
!命令
執行某個目錄下的sql文件
hive>source /root/my.sql
進入hive命令行靜默模式,靜默模式不產生MapReduce的調試信息,直接輸出結果
#hive -S
在操作系統命令行下執行命令
#hive -e 'show tables';
#hive -e 'select * from test1';
#hive -S -e?'select * from test1';
查看全部 -
hive遠程元數據庫配置
將mysql的jdbc的jar上傳到hive的lib目錄下
conf目錄下配置hive-site.xml文件
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://192.168.56.101:3306/hive</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>password</value>
</property>
</configuration>
參考配置屬性地址:
3.元數據中
tbls存儲數據表信息
columns_v2存儲數據字段信息
查看全部
舉報