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

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/roy_88/article/details/54948154

 续上一篇:

搭建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> create table Test(id int,name string);
OK
Time taken: 2.999seconds
hive> describe test;
OK
id                    int                                        
name                string                                      
Time taken: 0.821seconds, Fetched: 2 row(s)
hive>
--测试创建表,查看表信息,以上显示为测试成功显示效果

猜你喜欢

转载自blog.csdn.net/roy_88/article/details/54948154