搭建Hadoop2.7.3+Hive2.1.1及MySQL(配置Hive)(二)

分類:存儲 時間:2017-02-10

 續上一篇:

搭建Hadoop2.7.3+Hive2.1.1及mysql(配置Hadoop)(一)

1、  創建文件夾

1.1、在hive文件下創建文件夾

[root@localhost hive]# cd /usr/hive
[root@localhost hive]# mkdir warehouse

1.2、/tmp系統目錄下創建方法
[root@localhost tmp]# mkdir hive
[root@localhost tmp]# mkdirhive/operaion_logs
[root@localhost tmp]# mkdirhive/resources


2、  配置hive

2.1、生成配置文件

[root@localhost hive]# cd conf
[root@localhost conf]# cphive-env.sh.template hive-env.sh
[root@localhost conf]# cphive-default.xml.template hive-site.xml
[root@localhost conf]# cphive-log4j2.properties.template hive-log4j2.properties
[root@localhost conf]# cphive-exec-log4j2.properties.template hive-exec-log4j2.properties

   2.2、修改配置文件

   2.2.1、修改文件(hive-env.sh)

[root@localhostconf]# vim hive-env.sh

--添加

# sethadoop/hive/jdk(Java) path
exportHADOOP_HOME=/usr/hadoop
exportHIVE_HOME=/usr/hive
export JAVA_HOME=/usr/java/jdk1.8.0_111
exportHIVE_CONF_DIR=/usr/hive/conf


 

2.2.2、修改文件(hive-site.xml)

--編輯文件

[root@localhostconf]# gedit hive-site.xml


查找關健字

${system:java.io.tmpdir}/${hive.session.id}_resources替換為本機路徑/tmp/hive/resources

${system:java.io.tmpdir}/${system:user.name}/operation_logs替換為本機路徑/tmp/hive/operation_logs

${system:java.io.tmpdir}/${system:user.name}替換為本機路徑 /tmp/hive

3、  啟動hive(hadoop服務需要主啟用才能做以下操作)

3.1調用hive

[root@localhost hive]# schematool-dbType derby -initSchema
[root@localhost hive]# hive
hive> 
啟用成功顯示命令行顯示為 hive> 
3.2 測試連接

hive> createtable Test(id int,name string);
OK
Time taken: 2.999seconds
hive> describetest;
OK
id                    int                                        
name                string                                      
Time taken: 0.821seconds, Fetched: 2 row(s)
hive>
--測試創建表,查看表信息,以上顯示為測試成功顯示效果


Tags: 配置文件 文件夾 java 信息

文章來源:


ads
ads

相關文章
ads

相關文章

ad