Hive安裝及配置


 

(1)把apache-hive-1.2.1-bin.tar.gz上傳到linux的/opt/software目錄下

(2)解壓apache-hive-1.2.1-bin.tar.gz到/usr/local/目錄下面

/usr/local# tar -zxvf apache-hive-1.2.1-bin.tar.gz -C /usr/local

 

 

(3)修改apache-hive-1.2.1-bin.tar.gz的名稱為hive

mv apache-hive-1.2.1-bin/ hive

 

 

(4)修改/usr/local/hive/conf目錄下的hive-env.sh.template名稱為hive-env.sh

mv hive-env.sh.template hive-env.sh

 

 

 

(5)配置hive-env.sh文件

       (a)配置HADOOP_HOME路徑

    export HADOOP_HOME=/usr/local/hadoop (你的hadoop路徑)

       (b)配置HIVE_CONF_DIR路徑

    export HIVE_CONF_DIR=/usr/local/hive/conf  (你的hive路徑)

 

.Hive基本操作

(1)啟動hive

[atguigu@hadoop102 hive]$ bin/hive

(2)查看數據庫

hive> show databases;

(3)打開默認數據庫

hive> use default;

(4)顯示default數據庫中的表

hive> show tables;

(5)創建一張表

hive> create table student(id int, name string);

(6)顯示數據庫中有幾張表

hive> show tables;

(7)查看表的結構

hive> desc student;

(8)向表中插入數據

hive> insert into student values(1000,"ss");

(9)查詢表中數據

hive> select * from student;

(10)退出hive

hive> quit;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM