Hive的特點
- Hive與SQL陳述句相像
- 能將SQL陳述句轉變成MapReduce任務來執行
- Hive要依賴于yarn
- 只能用于結構化
- Hive只能處理離線資料,處理大型資料
Hive在集群上的操作
1.Hive安裝及配置
(1)點擊Shell,進入到 cd /opt/software目錄下
cd /opt/software/
(2)把apache-hive-3.1.2-bin.tar.gz壓縮包上傳到Shell的 cd /opt/software目錄下
(3)解壓apache-hive-3.1.2-bin.tar.gz 到cd /opt/module/目錄下
tar -zxvf /opt/software/apache-hive-3.1.2-bin.tar.gz -C /opt/module/
(4)修改apache-hive-3.1.2-bin.tar.gz 的名稱為hive-3.1.2
mv apache-hive-3.1.2-bin/ hive-3.1.2
cd hive-3.1.2/
(5)修改/etc/profile.d/my_env.sh,添加環境變數
sudo vim /etc/profile.d/my_env.sh
(6)my_env.sh 添加的內容
#HIVE_HOME
export HIVE_HOME=/opt/module/hive
export PATH=$PATH:$HIVE_HOME/bin
(7)加載配置資訊用source命令
source /etc/profile.d/my_env.sh
cd /lib
(8)解決日志jar包沖突:把log4j-slf4j-impl-2.10.0.jar 更名為log4j-slf4j-impl-2.10.0.bak
mv log4j-slf4j-impl-2.10.0.jar log4j-slf4j-impl-2.10.0.bak
ll (查看是否更名成功)
cd ..(退出至hive-3.1.2目錄)
(9)初始化元資料庫derby
bin/schematool -dbType derby -initSchema
(10)啟動Hive,進入到Hive界面(HQL陳述句)
bin/hive
show databases; (展示資料庫)
create database 'my_db'; (創建資料庫)
show tables;
create table test (id int); (建表tset:表名,欄位,欄位型別)
show tables;
desc test; (看表描述資訊)
insert into test values (1); (插入資訊)
select * from test;
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/356753.html
標籤:其他
