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

1、  创建文件夹
1.1、在hive文件下创建文件夹

[plain]  view plain  copy
  1. [root@localhost hive]# cd /usr/hive  
  2. [root@localhost hive]# mkdir warehouse  

1.2、/tmp系统目录下创建方法
[plain]  view plain  copy
  1. [root@localhost tmp]# mkdir hive  
  2. [root@localhost tmp]# mkdirhive/operaion_logs  
  3. [root@localhost tmp]# mkdirhive/resources  


2、  配置hive
2.1、生成配置文件

[plain]  view plain  copy
  1. [root@localhost hive]# cd conf  
  2. [root@localhost conf]# cphive-env.sh.template hive-env.sh  
  3. [root@localhost conf]# cphive-default.xml.template hive-site.xml  
  4. [root@localhost conf]# cphive-log4j2.properties.template hive-log4j2.properties  
  5. [root@localhost conf]# cphive-exec-log4j2.properties.template hive-exec-log4j2.properties  

   2.2、修改配置文件

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

[plain]  view plain  copy
  1. [root@localhostconf]# vim hive-env.sh  

--添加

[plain]  view plain  copy
  1. # sethadoop/hive/jdk(java) path  
  2. exportHADOOP_HOME=/usr/hadoop  
  3. exportHIVE_HOME=/usr/hive  
  4. export JAVA_HOME=/usr/java/jdk1.8.0_111  
  5. exportHIVE_CONF_DIR=/usr/hive/conf  


 

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

--编辑文件

[plain]  view plain  copy
  1. [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

[plain]  view plain  copy
  1. [root@localhost hive]# schematool -dbType derby -initSchema  
  2. [root@localhost hive]# hive  
[plain]  view plain  copy
  1. hive>   
启用成功显示命令行显示为 hive> 
3.2 测试连接

[plain]  view plain  copy
  1. hive> create table Test(id int,name string);  
  2. OK  
  3. Time taken: 2.999seconds  
  4. hive> describe test;  
  5. OK  
  6. id                    int                                          
  7. name                string                                        
  8. Time taken: 0.821seconds, Fetched: 2 row(s)  
  9. hive>  
--测试创建表,查看表信息,以上显示为测试成功显示效果
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值